fix(preview): regenerate previews whose stored file is gone - #63486
fix(preview): regenerate previews whose stored file is gone#63486rayvincent2 wants to merge 2 commits into
Conversation
f4090ea to
2e23e9c
Compare
|
Follow-up to the live-test note in the description: I have now run a path-scoped Context: I had already completed successful docker exec -u www-data -e PHP_MEMORY_LIMIT=2G nextcloud-manual_install-nextcloud \
php -d memory_limit=2G /var/www/html/occ preview:generate-all -vv \
--path "/ray/files/Photos/My Photos/2026"Results for /ray/files/Photos/My Photos/2026:
So this is a smoke / regression check that preview:generate-all still walks the tree cleanly with the patch applied when previews are already present. The original bug (DB row present, preview file missing → hard fail on readPreview) was verified earlier with single-file preview:generate on known-broken rows. I still have not live-tested object-store primary storage. |
When a preview row exists in the database but the backing file is missing, preview:generate failed with NotFoundException from LocalPreviewStorage::readPreview. Drop the stale row and generate a new preview instead so occ preview:generate and preview:generate-all can repair as they run. Fixes: nextcloud#63349 Assisted-by: Grok:grok-4.6 Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
ObjectExists() is a network round-trip per preview. Treat the DB row as authoritative for now so bulk listing stays cheap. Missing objects still fail later on read. Local storage keeps a real filesystem check. Assisted-by: Grok:grok-4.6 Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
2e23e9c to
fc37feb
Compare
|
/backport to stable35 |
|
/backport to stable34 |
|
/backport to stable33 |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
If a preview database row exists but the stored file is gone, generation used that row and then failed when it tried to read the file.
Generatornow checks that the file is still present, deletes the stale row if it is not, and regenerates the preview. That covers a missing max preview and missing extra sizes when several sizes are configured for one file.Unit tests cover local storage, object storage, and multiple sizes per file.
Live test: I applied this change on a Nextcloud 34.0.3 instance with local preview storage.
occ preview:generatehad been failing withNotFoundExceptionfromLocalPreviewStorage::readPreview(DB row for1535-2048-max.jpg, file missing). After the change the same command succeeded. Several other images were in the same state. Opening them in Memories requested previews again and those thumbnails regenerated instead of staying broken.I have not live-tested object store
or a full.preview:generate-allre-runChecklist
3. to review, feature component)stable32)AI (if applicable)
I used Grok to implement the fix and tests; I reviewed the diff, ran the unit tests, and verified it on 34.0.3.