Skip to content
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

[TUS] Upload to non-existing folder returns 500 instead of 404 #1264

Closed
PVince81 opened this issue Jun 18, 2020 · 2 comments
Closed

[TUS] Upload to non-existing folder returns 500 instead of 404 #1264

PVince81 opened this issue Jun 18, 2020 · 2 comments
Assignees
Labels

Comments

@PVince81
Copy link
Contributor

Uploading a file to a non-existing folder using Webdav API must return 404 instead of 500.

Errors in log:

==> reva-storage-home-data.log <==
2020-06-18T09:56:31+02:00 INF access token is already provided pkg=rhttp service=reva traceid=5cd961cf67b45a04f6c8dff718e05cc9
2020-06-18T09:56:31+02:00 DBG http routing: head=data tail=/4fac97d6-c65a-4a0d-8b68-a46f765632de svc=data pkg=rhttp service=reva
[tusd] 2020/06/18 09:56:31 event="RequestIncoming" method="PATCH" path="/4fac97d6-c65a-4a0d-8b68-a46f765632de" requestId="" 
2020-06-18T09:56:31+02:00 INF tusd routing: path=/4fac97d6-c65a-4a0d-8b68-a46f765632de pkg=rhttp service=reva traceid=5cd961cf67b45a04f6c8dff718e05cc9
[tusd] 2020/06/18 09:56:31 event="ChunkWriteStart" id="4fac97d6-c65a-4a0d-8b68-a46f765632de" maxSize="11" offset="0" 
[tusd] 2020/06/18 09:56:31 event="ChunkWriteComplete" id="4fac97d6-c65a-4a0d-8b68-a46f765632de" bytesWritten="11" 
9:56AM ERR home/vincent/Private/Work/workspace/reva/pkg/storage/fs/owncloud/upload.go:349 > ocfs: could not rename error="rename /var/tmp/reva/data/Alice/uploads/4fac97d6-c65a-4a0d-8b68-a46f765632de /var/tmp/reva/data/Alice/files/PARENT/randomfile.txt: no such file or directory" binPath=/var/tmp/reva/data/Alice/uploads/4fac97d6-c65a-4a0d-8b68-a46f765632de info={"ID":"4fac97d6-c65a-4a0d-8b68-a46f765632de","IsFinal":false,"IsPartial":false,"MetaData":{"dir":"/PARENT","filename":"randomfile.txt"},"Offset":11,"PartialUploads":null,"Size":11,"SizeIsDeferred":false,"Storage":{"BinPath":"/var/tmp/reva/data/Alice/uploads/4fac97d6-c65a-4a0d-8b68-a46f765632de","Idp":"https://localhost:9200","InternalDestination":"/var/tmp/reva/data/Alice/files/PARENT/randomfile.txt","LogLevel":"trace","Type":"OwnCloudStore","UserId":"Alice","UserName":"Alice"}} np=/var/tmp/reva/data/Alice/files/PARENT/randomfile.txt pid=13634
[tusd] 2020/06/18 09:56:31 event="ResponseOutgoing" status="404" method="PATCH" path="/4fac97d6-c65a-4a0d-8b68-a46f765632de" error="upload not found" requestId="" 
2020-06-18T09:56:31+02:00 WRN http end="18/Jun/2020:09:56:31 +0200" host=127.0.0.1 method=PATCH pkg=rhttp proto=HTTP/1.1 service=reva size=17 start="18/Jun/2020:09:56:31 +0200" status=404 time_ns=1293949 traceid=5cd961cf67b45a04f6c8dff718e05cc9 uri=/data/4fac97d6-c65a-4a0d-8b68-a46f765632de url=/data/4fac97d6-c65a-4a0d-8b68-a46f765632de

==> reva-frontend.log <==
2020-06-18T09:56:31+02:00 ERR Could not start TUS upload error="unexpected status code: 404" pkg=rhttp service=reva traceid=0b1a21dbfa37ce40f43e5cb5dd6ab99c
2020-06-18T09:56:31+02:00 ERR http end="18/Jun/2020:09:56:31 +0200" host=127.0.0.1 method=PUT pkg=rhttp proto=HTTP/1.1 service=reva size=0 start="18/Jun/2020:09:56:31 +0200" status=500 time_ns=57027080 traceid=0b1a21dbfa37ce40f43e5cb5dd6ab99c uri=/remote.php/webdav/PARENT/randomfile.txt url=/remote.php/webdav/PARENT/randomfile.txt

This is when running the test tests/acceptance/features/apiSharePublicLink1/createPublicLinkShare.feature:107 where apparently the "/PARENT" folder is missing in the skeleton.

For error handling, there are two places where this should be checked:

  1. Check for target folder existence and writability before initiating the TUS upload from the OCDAV layer
  2. In case the upload is in progress and the folder disappears before the completion, we need an additional check, or catch that rename error, and translate it to a 404 (or whatever is suitable for the TUS protocol)
@butonic butonic transferred this issue from owncloud/ocis-reva Jan 18, 2021
@refs refs added the Topic:TUS label Jan 18, 2021
@settings settings bot removed the Topic:TUS label Jan 29, 2021
@settings settings bot removed the p3-medium label Apr 7, 2021
@stale
Copy link

stale bot commented Jun 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status:Stale label Jun 6, 2021
@stale stale bot closed this as completed Jun 16, 2021
@stale stale bot removed the Status:Stale label Jun 18, 2021
@butonic butonic self-assigned this Nov 7, 2022
@butonic
Copy link
Member

butonic commented Nov 7, 2022

no longer reproducible, but another issue appeared: owncloud/web#7957

@butonic butonic closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants