fix(preview): regenerate previews whose stored file is gone - #63486
Open
rayvincent2 wants to merge 1 commit into
Open
fix(preview): regenerate previews whose stored file is gone#63486rayvincent2 wants to merge 1 commit into
rayvincent2 wants to merge 1 commit into
Conversation
rayvincent2
requested review from
Altahrim,
come-nc,
icewind1991 and
salmart-dev
and removed request for
a team
August 22, 2026 07:09
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>
rayvincent2
force-pushed
the
fix/63349/regenerate-missing-preview-files
branch
from
August 22, 2026 07:12
f4090ea to
2e23e9c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-run.Checklist
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.