Files: preview URLs keep stale thumbnails for up to a day after changes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, php
- Domain
- frontend
Research direction
Start with apps/files/src/composables/usePreviewImage.ts at the linked lines, then check how Core/Controller/PreviewController.php sets preview cache headers. Trace how the ETag becomes the preview URL cache buster and run the relevant preview tests. Done when the URL changes for closely spaced ETag updates so the browser fetches the refreshed thumbnail.
Written by the indexing model from the issue text.
Description
Bug description
The preview URL uses only the first 6 characters of the ETag (or of the mtime as fallback) as cache buster:
while previews are cached by the browser for 24 hours as immutable:
ETags generated with uniqid() (e.g. on object storage) only change their first 6 hex characters every 256 seconds, and the first 6 digits of a millisecond timestamp only every ~2.8 hours. So an image edited twice within a few minutes keeps showing the old thumbnail for up to a day. (The mtime fallback currently also throws, see #66919.)
Steps to reproduce
Found by code reading.
- With object storage as primary storage, upload an image and look at its thumbnail.
- Replace the image within a few minutes.
- The old thumbnail is still shown.
Expected behavior
The full ETag (or a hash of it) is used as cache buster.
Nextcloud version
master
- Dominant language
- PHP
- Stars
- 37.7k
- Forks
- 5.4k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 585
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/server
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
1. to develop bug feature: tags good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
1. to develop bug feature: federation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
1. to develop bug feature: dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
1. to develop bug feature: sharing
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
All issues in nextcloud/server
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
nhrrob/nhrrob-secure#35 ·
-
area/tests type/bug when/soon
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day