Syncing: Automatically create folder structure when uploading files
In order to improve synchronization between Files Client and Server, it would be helpful to automatically create the folder structure when uploading files.
Example: when doing an upload to /foo/bar/example.txt, automatically create /foo and /foo/bar
+1 here.
I can observe a lot of uploads resulting in 404 because the folder structure (very frequently, the last folder) doesn't exist, resulting in a never-end loop of trying to upload files that never succeeds.
PUT /remote.php/dav/files/user/InstantUpload/Camera/20250302_171042.jpg 404
I can observe a lot of uploads resulting in 404 because the folder structure (very frequently, the last folder) doesn't exist, resulting in a never-end loop of trying to upload files that never succeeds.
Where? This is a client (also counting the webui as one) issue.
Problem with this is, if we implement this we will break with the WebDAV standard as its required for the folder to exist before doing the upload (PUT) otherwise the server MUST respond with a 409 error.
So its up to the client to do the MKCOL before uploading.
See also the WebDAV RFC: https://datatracker.ietf.org/doc/html/rfc4918#section-9.7.1
It seems like even MKCOL calls need to have existing ancestor collections and must fail if not.
So basically there is no way to implement this without breaking the standard.
Where? This is a client (also counting the webui as one) issue.
I can observe this from Android clients as per requests User-Agent.
The proposed PR solves the standard-adherence question nicely by making this opt-in via custom header. Nice.
Is this feature going to be implemented as should in the future? The inconvenience of having to create the folders myself for auto-uploading photos is horrid.
As you can see this is already implemented in https://github.com/nextcloud/server/pull/53621 for Nextcloud 32 WebDAV compatible clients nevertheless should already handle this correctly as per standard.