-
Notifications
You must be signed in to change notification settings - Fork 113
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
Forbidden overwrite in public links with drop zone #2510
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
@gmgigi96 this only need to trigger inside a public link with "Uploader" role only, I think the current implementation applies to all writes. @ishank011 please confirm as well my assumption. |
And https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiSharePublicLink2/uploadToPublicLinkShare.feature#L268 has a similar scenario. Those scenarios define and explicit file-naming system that is used on oC10 - The requirement here in reva and oCIS is different. I will adjust the core API test suite so that it covers the different requirement/expectation for reva-oCIS. The file name format looks like it will be:
with the date in the ISO format YYYY-MM-DD. So the test can check that the file name matches that pattern. Will there be any date-time localization possible? US-style MM-DD-YYYY appearing? Or are we making the format fixed as above? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of changes, one being more an observation/request for discussion ;-)
There are "regular" upload test scenarios, where a regular user is overwriting their own file, or a sharee is overwriting a file that has been shared with them with write access. Those test scenarios expect the file name to remain the same and the content to be overwritten. If the code here does not preserve that, then I expect some unexpected test fails. |
@labkode @phil-davis indeed here I'm changing the file name for all the uploads, I will fix it considering the "Uploader" role only. @phil-davis for the format I think we could agree on a fixed one, to keep things as simple as possible, and maybe the one proposed by @glpatcern is a good format, so |
I am not so sure about ending up with 2 "." dots in the filename plus extension. That often confuses "ordinary users" like my mum. But the space character is also annoying to me (for nerds using the command line, or scripts it means that the file name has to be quoted or escaped or something special done with it). @micbar @butonic @dragotin @pmaier1or anyone else. Comments on the "timestamp" format please. |
um ... windows explorer appends |
yes, mum already gets confused. So I'm not sure that we will be able to "unconfuse" her when I give her an oCIS-reva-based cloud storage anyway ;) |
@butonic maybe the UNIX time is confusing not only for mum, what about 2018_02_03_07_30_00? |
I don't think having the date in the filename adds any value:
I recommend using |
Note: see also the discussion in and around issue comment #2480 (comment) "somebody"/"somebodies" will need to come up with an agreed requirement. |
lol ... so they use |
Move the checks to the ocdav service, for the PUT and POST handlers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just check if stat returned ok here https://github.com/cs3org/reva/blob/master/internal/http/services/owncloud/ocdav/put.go#L147. If it did, keep updating the appended timestamp to the path you pass to InitiateFileUpload
74ee1de
to
ede8616
Compare
This actually violates the PUT semantics, because we are not creating the resource requested in PUT. It cannot be retrieved with a subsequent GET request. IMO this should be fixed on the client side. http://www.webdav.org/specs/rfc4918.html#put-resources explicitly states:
What happens when a file with the appended timestamp already exists, because two uploaders upload in the same second? It seems like a POST request makes more sense here. File drop seems to be the exact usecase for RFC5995 - Using POST to Add Members to Web Distributed Authoring and Versioning (WebDAV) Collections |
Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This is true, but here we are only modifying the behavior in a drop zone (where an user has only
Indeed that's a problem, one of the twos files will be overridden. |
And we have this kind of problem in oC10 trashbin and versions. Those use 1-second timestamps and there is "trouble" if more than one action happens per second. And anyway, someone might have uploaded an actual files called |
I also favour the
Personally I don't like parenthesis and spaces in names, but I can handle it - no dealbreaker. Any objections against the (n+1) approach? |
Closes #2480