nextcloud / ios

📱 Nextcloud iOS App
https://itunes.apple.com/us/app/nextcloud/id1125420102
GNU General Public License v3.0
1.96k stars 881 forks source link

Upload: File modified datetime is changed during upload #1343

Open frieck opened 4 years ago

frieck commented 4 years ago

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:

Server configuration

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

marinofaggiana commented 4 years ago

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

frieck commented 4 years ago

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 commented 4 years ago

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

marinofaggiana commented 4 years ago

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

where appear this error ?

frieck commented 4 years ago

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

Thanks

marinofaggiana commented 4 years ago

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

frieck commented 4 years ago

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...

stratege-0815 commented 3 years ago

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?

wiegell commented 3 years ago

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 commented 3 years ago

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/photos/issues/2595 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.

stratege-0815 commented 3 years ago

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

laurens94 commented 3 years ago

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 commented 3 years ago

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)

DonDonatello commented 2 years ago

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.

HDebeuf commented 3 months ago

Maybe the following can help regarding some comments stating, the order in Photos part of the app are wrong. Until end 2023, no exif data was stored on the server side. This has now been fixed enabling changes in the Android app to sort photos by exif creation date, which seems the most wanted ordering per user experience. https://github.com/nextcloud/photos/issues/87 Could the fix applied in the Android app, help to fix the iOS app too? Thank you.