Skip to content

fix(thumbnails): never thumbnail files inside the shared thumbnail cache - #2032

Merged
l0gicgate merged 1 commit into
mainfrom
fix/2031-skip-thumbnail-cache-thumbnails
Nov 2, 2026
Merged

l0gicgate merged 1 commit into
mainfrom
fix/2031-skip-thumbnail-cache-thumbnails

Conversation

@l0gicgate

Copy link
Copy Markdown
Contributor

Description

Browsing ~/.cache/thumbnails made Strata render a thumbnail for every cache entry and store it back into the same cache, so each new entry became another file to thumbnail and the directory grew without bound until the user navigated away.

thumbnail_cache::store and thumbnail_cache::lookup now refuse any path under the shared thumbnails tree (the parent of the large bucket). Both the lexical path and the resolved path are checked, so a symlinked cache directory or a symlinked entry does not bypass the guard. Entries in the cache are still rendered in memory, so the browser keeps showing them as images; they are just never persisted. A sibling directory such as thumbnails-old is unaffected.

A regression test covers an entry inside large, an entry in a sibling bucket, an entry reached through a symlink to the cache root, and a look-alike directory outside the tree. docs/preview-sandbox.md records the behaviour.

Visual evidence

N/A. The change prevents files from being written; nothing visible changes in the browser.

How to test

  1. Enable Show thumbnails and open a folder with a few images so the cache has entries.
  2. In Strata, navigate to ~/.cache/thumbnails/large and wait a few seconds.
  3. Reload the directory or watch it from a terminal with watch ls ~/.cache/thumbnails/large | wc -l.

Expected result: The entry count stays constant while browsing the cache, and the PNGs still display as image thumbnails. Before this change the count kept growing until the directory was left.

Related issue

Closes #2031

Browsing $XDG_CACHE_HOME/thumbnails stored a thumbnail for every cache
entry, which in turn became a new entry, so the directory grew without
bound until the user left it. Files anywhere under the thumbnails tree
are now excluded from both disk lookup and store, checked against the
lexical and the resolved paths so a symlinked cache or entry cannot
slip through.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

do not generate thumbnails while browsing the thumbnails directory

1 participant