Skip to content

fix(preview): Handle unique constraints violation exception#61950

Open
CarlSchwan wants to merge 1 commit into
masterfrom
carl/catch-unique-exception
Open

fix(preview): Handle unique constraints violation exception#61950
CarlSchwan wants to merge 1 commit into
masterfrom
carl/catch-unique-exception

Conversation

@CarlSchwan

Copy link
Copy Markdown
Member

Summary

Delete the preview from storage and fetch the actual one from the DB. This should not happen often.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Delete the preview from storage and fetch the actual one from the DB.
This should not happen often.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan added this to the Nextcloud 35 milestone Jul 9, 2026
@CarlSchwan CarlSchwan self-assigned this Jul 9, 2026
@CarlSchwan CarlSchwan requested a review from a team as a code owner July 9, 2026 15:24
@CarlSchwan CarlSchwan added bug 3. to review Waiting for reviews labels Jul 9, 2026
@CarlSchwan CarlSchwan requested review from Altahrim and salmart-dev and removed request for a team July 9, 2026 15:24
@CarlSchwan

Copy link
Copy Markdown
Member Author

/backport to stable34

@solracsf

solracsf commented Jul 9, 2026

Copy link
Copy Markdown
Member

I don't think the recovery path works as written, worth review in case I'm missing a key info here.

getPreviewForSpecification() builds its WHERE clause from raw array keys used as literal column names. The caller passes 'fileId', but the column is actually file_id, that's a genuine SQL "unknown column" error, thrown before findOneQuery() ever reaches the DoesNotExistException catch this method relies on.

So the exact race this PR targets would still crash, just with a different exception than before.
😿

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Integrity constraint violation: 1062 Duplicate entry for key 'previews_file_uniq_idx'

4 participants