0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-02 13:00:42 +00:00
nextcloud_server/apps/files_versions/lib
Ferdinand Thiessen 378eb64d8e fix(files_versions): create version if previous does not exist
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>
2025-04-24 11:31:13 +00:00
..
AppInfo chore: Add SPDX header 2024-06-02 20:00:00 +02:00
BackgroundJob chore: Add SPDX header 2024-06-02 20:00:00 +02:00
Command chore: Add SPDX header 2024-06-02 20:00:00 +02:00
Controller feat(files_versions): Implement preview mime icon fallback 2025-03-28 12:01:58 +01:00
Db chore: Add SPDX header 2024-06-02 20:00:00 +02:00
Events chore: Add SPDX header 2024-06-02 20:00:00 +02:00
Listener fix(files_versions): create version if previous does not exist 2025-04-24 11:31:13 +00:00
Migration chore: Add SPDX header 2024-06-02 20:00:00 +02:00
Sabre fix: Use timestamp instead of revision id in files_versions metadata API 2024-07-24 09:34:13 +02:00
Versions Merge pull request #46887 from nextcloud/fix/versions-catch-insertion-error 2024-08-14 10:32:45 +02:00
Capabilities.php chore: Add SPDX header 2024-06-02 20:00:00 +02:00
Expiration.php fix(files_versions): Do not expire versions newer than min age 2025-02-25 15:03:13 +00:00
Storage.php fix(files_versions): Do not expire versions newer than min age 2025-02-25 15:03:13 +00:00