Fix timestamp when looking at photos#3571
Open
tintou wants to merge 3 commits into
Open
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
come-nc
reviewed
Jun 29, 2026
Comment on lines
-70
to
-76
| // 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; | ||
| } | ||
|
|
Contributor
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?
Author
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)
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.
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