Skip to content

Conversation

@backportbot
Copy link

@backportbot backportbot bot commented Apr 24, 2025

Backport of PR #52373

This issue happens reproducible if:
- Versions is disabled
- Upload a file
- Enable versions
- Upload same file unchanged
- Now the error happens.

Problem is that the mtime is unchanged so no version will be created on the upload, but it tries to update the last version which does not exists.
Instead of "upload same file unchanged" you can also - like in the example stack trace above - use Android with an SD card with invalid mtime -> the mtime will be stripped so its always the same.
Instead of disable versions the same also happens if e.g. the versions creation failed due to other issues.

The solution now is to catch the exception and create if not exists.
A cleaner solution would be to have a method on the versions backend
like `hasVersionEntity(File $file, int $revision): bool` but this would
be a breaking change or at least a feature that apps need to implement.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@backportbot backportbot bot requested review from artonge, come-nc and susnux April 24, 2025 11:31
@backportbot backportbot bot added this to the Nextcloud 31.0.5 milestone Apr 24, 2025
@AndyScherzinger AndyScherzinger merged commit a2979dc into stable31 Apr 24, 2025
203 of 210 checks passed
@AndyScherzinger AndyScherzinger deleted the backport/52373/stable31 branch April 24, 2025 17:15
@blizzz blizzz mentioned this pull request May 5, 2025
10 tasks
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.

4 participants