Fix timestamp when looking at photos#3571
Conversation
A camera with a reset clock can produce DateTimeOriginal '1970:01:01 00:00:00', which parses successfully but yields timestamp 0. Storing 0 sorts the file to the bottom of the DAV SEARCH DESC results, making it unreachable via pagination. Fixes: nextcloud#2768 Assisted-by: claude:claude-sonnet-4-6 Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
… storage The isLocal() guard was copied from ExifMetadataProvider, which reads file bytes. This provider only uses filename and mtime from the local file cache, so deferring to a background job left original_date_time as NULL for remote storage until the job ran, causing photos to be invisible or misplaced in the timeline. Fixes: nextcloud#2768 Assisted-by: claude:claude-sonnet-4-6 Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Non-standard S3-compatible backends may return 0 for Last-Modified. Storing 0 breaks sorting; leaving the metadata unset (NULL) is safer. Fixes: nextcloud#2768 Assisted-by: claude:claude-sonnet-4-6 Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
a492882 to
d1f68f6
Compare
| // We need the file content to extract the EXIF data. | ||
| // This can be slow for remote storage, so we do it in a background job. | ||
| if (!$node->getStorage()->isLocal() && $event instanceof MetadataLiveEvent) { | ||
| $event->requestBackgroundJob(); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
I’m not sure I understand the rationale.
The code below reads exif metadata, that does access the file bytes, so the guard was correct and the commit comment is wrong?
There was a problem hiding this comment.
It is not reading the exif but getting the cached exif here (from what I understand from the code)
|
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.) |
Reject timestamp 0 as it is very unlikely to represent the right time and least to photos being unsorted.
This is especially true for my setup using the S3 from OVH that seem to not return the mtime.
🤖 AI (if applicable)
Fixes: #2768