Content
View differences
Updated by Wieland Lindenthal over 3 years ago
Requirements:
* Authenticates and authorizes (basic auth) with a token as a parameter in the URL
* Check that token is still valid
* Check to which user it belongs and act on behalf of that user. But also allow uploads to public folders that allow anonymous uploads.
* Check that folder with that _file ID_ exists.
* Check if file with same name exists in that folder
* If true:
* overwrite parameter present?
* if true
* check that you have write access the user has the permission to upload (write) on that file
_file ID._
* if write allowed
* update file
* if write not allow
* return "Not allowed" else: respond with the right error
* if false
Accepts PUT/POST(?) on /direct-upload
* check that you (still) allowed to create the file
Multipart form? <mention class="mention" data-id="71476" data-type="user" data-text="@Eric Schubert">@Eric Schubert</mention> , why multipart?
* find a unique file Handle duplicate name that is similar (suffix with conflicts by appending a number)
* write number " (1)" to the file
* return
* `file_name`
* `file_id`
* overwrite parameter not present
* file name. If there already exists?
* if true:
* Cancel request and tell the client that we have is a conflict
* if false:
* check that you (still) allowed to create the file
* write the file
* return
* `file_name`
* `file_id`
* if false:
* check with that you (still) allowed to create number, take the file
* write the file
* return
* `file_name`
* `file_id` next number, etc...
* Accepts POST(?) Returns
* Route: `direct-upload/<token>`
`path` (of that file)
* Multipart form
* `overwrite` (optional) `fileId`
* Allow CORS preflights (HTTP OPTION) requests (see [https://docs.nextcloud.com/server/latest/developer\_manual/digging\_deeper/rest\_apis.html#rest-apis)](https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/rest_apis.html#rest-apis))
* Revoke the token after successful upload.
* Authenticates and authorizes
* Check that token is still valid
* Check to which user it belongs and act on behalf of that user.
* Check that folder with that _file ID_ exists.
* Check if file with same name exists in that folder
* If true:
* overwrite parameter present?
* if true
* check that you have write access
* update file
* if write not allow
* return "Not allowed"
* write
* return
* `file_name`
* `file_id`
* overwrite parameter not present
* file
* if true:
* Cancel request and tell the client that we have
* if false:
* check that you (still) allowed to create the file
* write the file
* return
* `file_name`
* `file_id`
* if false:
* check
* write the file
* return
* `file_name`
* `file_id`
* Accepts POST(?)
* Route: `direct-upload/<token>`
* `overwrite` (optional)
* Allow CORS preflights (HTTP OPTION) requests (see [https://docs.nextcloud.com/server/latest/developer\_manual/digging\_deeper/rest\_apis.html#rest-apis)](https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/rest_apis.html#rest-apis))
* Revoke the token after successful upload.