ios icon indicating copy to clipboard operation
ios copied to clipboard

Upload: File modified datetime is changed during upload

Open frieck opened this issue 3 years ago • 14 comments

Expected behaviour

iOS photos to be uploaded with correct date time

Actual behaviour

Uploaded file datetime seems to be using the modified date, and the modified date seems to be changing to current time during upload. Tested it by uploading several photos from my iPhone from different years, for example:

  • Uploaded a photo from 2018, this is what I am getting on PHP:
    • X-OC-MTime: 1594328285.316689 - This was the exactly time of the upload like if the photo was changed during the upload process(?)
    • X-OC-CTime: 1537457032.4036608 - This is the time the photo was shooted, and I think this should be the time the file should have inside Nextcloud.

Steps to reproduce

Just upload a photo from other day than today.

Reasoning or why should it be changed/implemented?

So we can have photos displayed in correct order.

iOS version

13.5.1

App version

3.0.1

Server configuration

Operating system: Debian Web server: nginx Database: MariaDB PHP version: 7.3 Nextcloud version: (see Nextcloud admin page) 19

frieck avatar Jul 09 '20 21:07 frieck

Hi @frieck X-OC-MTime is the modification time and X-OC-CTime is the creation time, this value are get from iOS Asset photo/video:

https://github.com/nextcloud/ios/blob/606a68a2fc25d9118fedb4c3f96d9a986dec3404/iOSClient/Utility/CCUtility.m#L1456

marinofaggiana avatar Jul 12 '20 10:07 marinofaggiana

Hello @marinofaggiana you modified this a couple days ago: https://github.com/nextcloud/ios/commit/972fa1a74c76c27fceb1e4c21708719fd2926f32#diff-581efc20f9d776a2c155f68a1a911c99

I was looking at the code and changed the same file and was planning a pull request. That modified date was coming from the temporary file, that is why it was always the current date (or the date the temporary file was created).

Are you planning to release this fix soon?

Thanks

frieck avatar Jul 12 '20 23:07 frieck

Hi @marinofaggiana I am testing 3.0.2 (13). Now app seems more stable, but for some reason I can't view excluded items: error 500. Now photos are uploaded with original file modification date! But I still have a question: Do you know why some files get randomly modified? For exemple, I photo that I took last year is uploaded with a modification date of 14 days ago. Thanks

frieck avatar Jul 27 '20 12:07 frieck

but for some reason I can't view excluded items: error 500.

where appear this error ?

marinofaggiana avatar Jul 27 '20 13:07 marinofaggiana

It was something on the server... it is fixed now. Can you answer the question I did about modified date?

Thanks

frieck avatar Jul 27 '20 17:07 frieck

The modificationDate is get from photo asset, and is managed from iOS.

marinofaggiana avatar Jul 28 '20 09:07 marinofaggiana

And do you know why modification date changes randomly when uploading photos from Nextcloud? It is very odd!

Can we add a feature so users can opt to always use the creation time when uploading photos? I can try to submit a PR...

frieck avatar Sep 12 '20 12:09 frieck

I use iOS 14.3 and the latest nextcloud server and iOS client - this ist still not workling and makes nextcloud unusable for me. Evereything else workes just fine, but I wasn't expecting such problems. Can I do anything to push this in priority?

stratege-0815 avatar Jan 19 '21 11:01 stratege-0815

Also a problem for me at app version 4.0.1.1, iOS 14.4.2, NC 21.0.2. Very frustrating. Photos should be sorted from the exif "content created", but i can see a use for the modification date to overrule that (e.g. if someone made changes to the image). Why not simply have both as sorting options like on windows/macos etc? Still seem to have pseudo-random changes to the modification date. It might only happen when sharing to nextcloud via the context share button from e.g. native apple photos?

wiegell avatar Jun 21 '21 10:06 wiegell

Photo view and sorting is mentioned several other places, but maybe the sorting is done server side? See: https://github.com/nextcloud/android/issues/7451#issuecomment-732111772 Related issues regarding photo sorting: https://github.com/nextcloud/ios/issues/326 https://github.com/nextcloud/ios/issues/948 https://github.com/nextcloud/ios/issues/1525 https://github.com/nextcloud/ios/issues/1611 https://github.com/nextcloud/android/issues/7451 https://github.com/nextcloud/android/issues/4550 https://github.com/nextcloud/android/issues/3667

IMO this is a core feature that is expected to work and hasn't for some time now. Hope to see this solved.

wiegell avatar Jun 21 '21 10:06 wiegell

I did never use any "context share button for apple photos" - I used the automatical upload in the iOS app. Maybe this helps...

stratege-0815 avatar Jun 22 '21 09:06 stratege-0815

I just noticed all the metadata of my uploaded photos from the iOS app are ruined. The upload date is being used instead of the original photo creation date.

I just wish I found about this sooner... 😂

laurens94 avatar Jul 30 '21 21:07 laurens94

I found a solution to correct the creation and modified dates based on the filenames using exiftool (https://exiftool.org).

In my case, all pictures that were uploaded via Nextcloud on iOS where named something like '2021-07-28_13-40-03 7653.jpg'

After installing exiftool and running exiftool -overwrite_original "-filemodifydate<filename" "-createdate<filename" . in the folder that contained the images, the exif data was valid again 🥳 (make a backup before or try it without the -overwrite_original flag to test it out first)

laurens94 avatar Jul 30 '21 22:07 laurens94

Can confirm and reproduce this issue.

Nextcloud 24.0.2 (Debian Bullseye, docker, php-fm, nginx, MariaDB)

iOS Nextcloud app version 4.4.0.18, iOS 15.5

Tried fresh install of both server and iOS app with same effect.

iOS Photos app displays correct date/time and JPEG, HEIC and DNG files produce same fault. Same behaviour using manual upload and auto-upload.

Edit: one additional observation - if the image is uploaded from the builtin Files app, the timestamp gets transferred correctly. So this issue only affects images uploaded from the Photos app.

DonDonatello avatar Jul 09 '22 12:07 DonDonatello