-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
oCIS FS: zero size file uploads create a blob entry in upload target #2609
Comments
Bug descriptionHere we check if the upload size is if !info.SizeIsDeferred && info.Size == 0 {
...
err := u.FinishUpload(ctx) <-- Early finish
... If that is the case we finish the upload in line 303. Now we get back to the ocdav handler: uRes, err := client.InitiateFileUpload(ctx, uReq)
...
httpReq, err := rhttp.NewRequest(ctx, http.MethodPut, ep, r.Body)
...
httpReq.Header.Set(datagateway.TokenTransportHeader, token)
httpRes, err := s.client.Do(httpReq) Even though the upload was finished already, the ocdav handler doesn't know this and continues with the simple dataprovider, which will eventually end up here: upload, err := fs.GetUpload(ctx, ref.GetPath()) <-- fail because no file in uploads directory
if err != nil {
// Upload corresponding to this ID was not found.
...
metadata := map[string]string{"sizedeferred": "true"}
uploadIDs, err := fs.InitiateUpload(ctx, ref, 0, metadata) <-- Second initiate upload = UUID file
...
if upload, err = fs.GetUpload(ctx, uploadIDs["simple"]); err != nil {
... There it will try to get the upload and fail because we never wrote a Possible SolutionWe either need to remove the early finish in the |
oCDAV also has a special case for zero byte uploads |
Describe the bug
Upload a zero size file to oCIS running on oCIS FS.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
You see exactly the file you uploaded
Actual behavior
You see the file you uploaded and a file with a UUIDv4.
Setup
oCIS master on e4cc2a5, but same behaviour was on oCIS 1.12.0
The text was updated successfully, but these errors were encountered: