Hi, is there a way to set the mtime of a file during upload via the Web API, or is there a way to set the mtime afterwards? I looked at the documentation and couldn’t find anything related.
Background: I’d really like to preserve photo timestamps in the Android client because my photo management software sorts them by mtime. AFAIK the Android client uses the Web API, so any functionality not present in the Web API can’t be used by the client.
Uploading files via the Windows SeaDrive client does appear to preserve the “last modified” timestamp, so there’s definitely some functionality for it somewhere. I wonder if that’s a private API though. Hmm.
AFAICS the desktop Seafile client can do that as well, not just the SeaDrive client. Unless I’m mistaken, this depends on whether you want to use the documented Web API (in which case mtime is not settable) or some other interface (in which case mtime is settable in some way).
That said, it would be interesting to look at a network dump of an operation where SeaDrive or the desktop client set the mtime of a file, and then document the inner workings of that operation.
A capture from the desktop Seafile client confirmed that the desktop client does not use the Web API, and the way it uploads files with correct mtime is totally different.
The good news is that the Seafile server won’t complain if you POST additional upload parameters (i.e. not just the filename, but also the mtime) via Web API to the server. This means extending the Web API is easy to do in a backward-compatible way. Just send the mtime from the client, and the server will ignore it if not supported. I have a modified version of the python-seafile which adds mtime to uploads.
Is anyone familiar with the server side of the Web API? To be precise, I’m looking for the function which handles POST requests to /api2/repos/%s/upload-link/ . That function needs to be extended to not only pass on the filename, but also the mtime. That would solve this feature request.