iterate-ch / cyberduck

Cyberduck is a libre FTP, SFTP, WebDAV, Amazon S3, Backblaze B2, Microsoft Azure & OneDrive and OpenStack Swift file transfer client for Mac and Windows.
https://cyberduck.io/
GNU General Public License v3.0
3.22k stars 286 forks source link

Modification date is not preserved when uploading to Dropbox #15381

Closed stszap closed 10 months ago

stszap commented 10 months ago

Describe the bug When I try to upload to Dropbox via cyberduck the modification date is always set to the current time. When using the native Dropbox client for upload or cyberduck for download the date is preserved. "Preserve modification date" option is enabled. I also tried to restart cyberduck a few times - no luck.

To Reproduce Steps to reproduce the behavior:

  1. Create a connection to Dropbox
  2. Upload a file
  3. The modification time is set to current time

Expected behavior The modification time in Dropbox is the same as the local file.

Screenshots cyberduck_db_date (cropped to hide Dropbox email)

Desktop (please complete the following information):

Log Files I'm reluctant to post the whole log file in the open but this looks like a relevant part I believe (this log is unrelated to the screenshot above):

2023-11-21 23:57:27,724 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /2/files/upload_session/finish HTTP/1.1
2023-11-21 23:57:27,724 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - POST /2/files/upload_session/finish HTTP/1.1
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Dropbox-API-Path-Root: {".tag":"root","root":"5310331120"}
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Content-Type: application/octet-stream
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - User-Agent: Cyberduck/8.7.1.40770 (Mac OS X/12.7.1) (x86_64) OfficialDropboxJavaSDKv2/5.4.4
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Dropbox-API-Arg: {"cursor":{"session_id":"pid_upload_session:ABIHFfw6ltP80o58OQenBpGjr8VbENxQ2mPLsk6bK7J0NS3r6A","offset":1164087},"commit":{"path":"/ks__6815.pdf","mode":"overwrite","autorename":false,"mute":false,"strict_conflict":false}}
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Transfer-Encoding: chunked
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Host: content.dropboxapi.com
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Connection: Keep-Alive
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Accept-Encoding: gzip,deflate
2023-11-21 23:57:27,725 [httpexecutor-https://content.dropboxapi.com/2/files/upload_session/finish-1] INFO  ch.cyberduck.transcript.request - Authorization: ********

You can clearly see that Dropbox-API-Arg header for POST /2/files/upload_session/finish request doesn't have commit.client_modified parameter which is supposed to be used to set a custom modification time as per the documentation.

markabur commented 9 months ago

Would this fix also affect Cloudflare R2, or should I open a separate issue?

stszap commented 9 months ago

Would this fix also affect Cloudflare R2, or should I open a separate issue?

The fix worked with backblaze too (I later discovered that it was also affected). I don't have cloudflare account to test, but you can try snapshot build.

dkocher commented 9 months ago

Would this fix also affect Cloudflare R2, or should I open a separate issue?

You would need to adapt the CloudFlare R2 ^1 connection profile adding the custom property to enable setting timestamps in metadata for S3 objects as in the S3 (Timestamps) ^2 profile.

        <key>Properties</key>
        <array>
            <string>s3.listing.metadata.enable=true</string>
        </array>

This is not enabled by default because of performance implications with additional requests required to read and write the modification date in metadata.