Not possible to update file modification time through cURL (or other methods)?

I tried many different cURL commands to upload/update files on my Nextcloud 18.0.6 server and tested which preserves the original modification timestamp (or accepts a change through the X-OC-Mtime header):

Uploading a file sets the upload date as file modification time (= does not preserve mtime):

curl -vs -u user:pass -T "/mnt/user/music/song.mp3" "" 2>&1

Moving the file to the same destination (overwriting) returns the Sabre DAV error “Source and destination uri are identical”:

curl -vs -X MOVE -u user:pass --header 'X-OC-Mtime: 1574254490' --header 'Destination:'  2>&1

Moving with overwrite command returns the Sabre DAV error “Source and destination uri are identical”:

curl -vs -X MOVE -u user:pass --header 'X-OC-Mtime: 1574254490' --header 'Overwrite: T' --header 'Destination:'  2>&1

Moving to a new destination ignores the X-OC-Mtime: :cry:

curl -vs -X MOVE -u user:pass --header 'X-OC-Mtime: 1574254490' --header 'Destination:'  2>&1

New upload with X-OC-MTime “preserves” file modification time:

curl -vs -u user:pass  --header 'X-OC-Mtime: 1574254490' -T "/mnt/user/music/song.mp3" "" 2>&1

Uploading without a file overwrites the already existing file on the server by an empty file and “preserves” the modification time: :thinking:

curl -vs -X PUT -u user:pass --header 'X-OC-Mtime: 1574254490' "" 2>&1

Copying the file causes a new copy timestamp (X-OC-Mtime has been ignored):

curl -vs -X COPY -u user:pass --header 'X-OC-Mtime: 1574254490' --header 'Destination:'  2>&1

The very last command I tried was PROPPATCH , but I’m not sure if I did it wrong:

curl -vs -X PROPPATCH -u user:pass --header 'Content-Type: application/xml; charset="utf-8"' --data '<?xml version="1.0"?><d:propertyupdate xmlns:d="DAV:" xmlns:nc=""><d:set><d:prop><d:getlastmodified>Mon, 22 Jun 2020 19:20:21 GMT</d:getlastmodified></d:prop></d:set></d:propertyupdate>' "" 2>&1

It returns the HTTP Header “207 Multi-Status” and the following content:

<d:multistatus xmlns:d="DAV:" xmlns:s="" xmlns:oc="" xmlns:nc=""><d:response><d:href>/remote.php/webdav/music/song.mp3</d:href><d:propstat><d:prop><d:getlastmodified/></d:prop><d:status>HTTP/1.1 403 Forbidden</d:status></d:propstat></d:response></d:multistatus>

Do I really need to re-upload all my files to preserve the timestamps or did I miss a command?

Ok, the PROPPATCH method (the optimum solution) does not work because a sabre/dav developer refuses to remove the protection status of the getlastmodified property (the reason why the X-OC-MTime dirty hack in Owncloud / Nextcloud even exists):

Maybe you could support me and comment in this issue so he hopefully rethinks his decision. It doesn’t make sense that this property is protected at all. The spec says “should” and only because of rare cases to re-fill a cache.