mirror of
https://github.com/photoprism/photoprism.git
synced 2026-03-02 22:57:18 -05:00
Upload: Preserve file modification timestamps #1979
Labels
No labels
ai
android
api
auth
awesome
bug
bug
ci
cli
config
database
declined
deprecated
docker
docs 📚
documents
duplicate
easy
enhancement
enhancement
enhancement
epic
faces
feedback wanted
frontend
hacktoberfest
help wanted
idea
in-progress
incomplete
index
invalid
ios
labels
live
live
low-priority
macos
member-feature
metadata
mobile
nas
needs-analysis
no-coding-required
no-coding-required
observability
performance
places
please-test
plus-feature
priority
pro-feature
question
raspberry-pi
raw
released
released
released
research
resolved
security
sharing
tested
tests
third-party-issue
thumbnails
upgrade
upstream-issue
ux
vector
video
waiting
won't fix
won't fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/photoprism#1979
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cttlee on GitHub (Dec 8, 2023).
Describe what problem this solves and why this would be valuable to many users
Describe the solution you'd like
Photoprism didn't use mtime as timestamp when no related exif info
Use mtime as timestamp as like google photo when no related exif info
The same logic can be found on immich as well
https://github.com/immich-app/immich/issues/4188
Describe alternatives you've considered
Updating by exiftool manually was difficult since files were tens of thousands, also some video formats were not supported by exiftool and some files did not have exif such as screenshot pictures.
Additional context
@lastzero commented on GitHub (Dec 8, 2023):
See our User Guide FAQ at https://docs.photoprism.app/user-guide/faq/#metadata:
@cttlee commented on GitHub (Dec 8, 2023):
00000.zip
I uploaded one mts and one jpeg to photoprism demo,


mtime were 2011 and 2004, but both be shown at 2023/12
date on google photo

@lastzero commented on GitHub (Dec 8, 2023):
@cttlee So the feature request would be to preserve the local file system timestamps when using the web upload (which effectively creates new files on the server)?
I suppose the local time could be read through the JS File API and then transferred along with the files to preserve the time e.g. similar to this:
Source: https://github.com/flohall/files_upload_mtime/blob/master/js/upload_mtime.js
If someone extends the frontend as needed and sends a pull request, I'd be happy to add support for preserving timestamps on the server side:
A suitable request header name for adding the information could be
X-Last-Modified, ideally in some standard format e.g. as a unix timestamp or ISO date.On the server, the code might look similar to how the "favorite" flag is preserved when uploading via WebDAV:
github.com/photoprism/photoprism@ff37fc2d53/internal/server/routes_webdav.go (L76-L82)@phpbg commented on GitHub (Dec 9, 2023):
Hi, does your web upload uses webdav protocol? FYI nextcloud uses
X-OC-MTimeandX-OC-CTimeheaders.See https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#request-headers
@lastzero commented on GitHub (Dec 9, 2023):
We offer a WebDAV api you can use. See our documentation. The basic web upload does not use WebDAV though.
@phpbg commented on GitHub (Dec 9, 2023):
OK, thanks for your info. I just saw the discussion for creation/modification timestamps over webdav happens here: https://github.com/photoprism/photoprism/discussions/2550
@lastzero commented on GitHub (Jan 8, 2024):
@cttlee I just added an experimental implementation for setting the mtime based on the
X-OC-MTimeheader. However, this only works with WebDAV and not with the regular file upload in the Web UI. It also requires using a WebDAV client that sends this custom header when uploading files:Any help with testing will be much appreciated once an updated development preview is available. In the meantime, you can also test with the
photoprism/photoprism:testimage temporarily available on Docker Hub to test the other changes we are working on.