-
Notifications
You must be signed in to change notification settings - Fork 5
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
WebDAV: Fix PUT to overwrite file if already exists #92
WebDAV: Fix PUT to overwrite file if already exists #92
Conversation
cc3964f
to
9da86c5
Compare
The WebDAV specification [^1] states that in case of a `PUT /…/file`, if the resource `/…/file` already exists and is not a collection (= a directory), then it should be replaced in place (= overwritten). This commit fixes that. It can be tested with a simple WebDAV client like `curl`: # Write once: curl -k -T my-file.txt https://webdav.local.internxt.com:3005 # Read: curl -k https://webdav.local.internxt.com:3005/my-file.txt # Overwrite (this should not fail): curl -k -T my-file.txt https://webdav.local.internxt.com:3005 Note: I wrote this commit because otherwise the server from `internxt webdav enable` bugs with some WebDAV clients. [^1]: http://www.webdav.org/specs/rfc4918.html#put-resources
9da86c5
to
5dc622d
Compare
Rebased on latest |
Hello @apsantiso, @PixoDev and @larryrider, I see you worked on the WebDAV server code recently. Could you have a look at this pull request? It fixes a real bug that prevents the use of Internxt. Thanks :) |
Hey! @adrienverge Thank you for your work, we will check it asap and if its ok it will be merged for sure! |
Hey @adrienverge , thank you so much for your contribution! I reviewed your implementation, however we don't replace file content that way (trash + delete + upload). Instead we do the following on other platforms:
If you need some more guidance with this, we'll be happy to help |
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.
Check our comment about replacing file content please
This is another implementation of my fix proposed at internxt#92, with suggestions from @PixoDev. Instead of trashing + uploading, it replaces the file in place. The WebDAV specification [^1] states that in case of a `PUT /…/file`, if the resource `/…/file` already exists and is not a collection (= a directory), then it should be replaced in place (= overwritten). This commit can be tested with a simple WebDAV client like `curl`: # Write once: curl -k -T my-file.txt https://webdav.local.internxt.com:3005 # Read: curl -k https://webdav.local.internxt.com:3005/my-file.txt # Overwrite (this should not fail): curl -k -T my-file.txt https://webdav.local.internxt.com:3005 Note: I wrote this commit because otherwise the server from `internxt webdav enable` bugs with some WebDAV clients. [^1]: http://www.webdav.org/specs/rfc4918.html#put-resources
Thanks @larry-internxt and @PixoDev!
Indeed, it makes more sense to just replace without trashing. Please see my other implementation at #107 (I open a separated PR to keep this original code somewhere, because at the moment this is the only one that allows me to use Internxt). |
This is another implementation of my fix proposed at internxt#92, with suggestions from @PixoDev. Instead of trashing + uploading, it replaces the file in place. The WebDAV specification [^1] states that in case of a `PUT /…/file`, if the resource `/…/file` already exists and is not a collection (= a directory), then it should be replaced in place (= overwritten). This commit can be tested with a simple WebDAV client like `curl`: # Write once: curl -k -T my-file.txt https://webdav.local.internxt.com:3005 # Read: curl -k https://webdav.local.internxt.com:3005/my-file.txt # Overwrite (this should not fail): curl -k -T my-file.txt https://webdav.local.internxt.com:3005 Note: I wrote this commit because otherwise the server from `internxt webdav enable` bugs with some WebDAV clients. [^1]: http://www.webdav.org/specs/rfc4918.html#put-resources
This is another implementation of my fix proposed at internxt#92, with suggestions from @PixoDev. Instead of trashing + uploading, it replaces the file in place. The WebDAV specification [^1] states that in case of a `PUT /…/file`, if the resource `/…/file` already exists and is not a collection (= a directory), then it should be replaced in place (= overwritten). This commit can be tested with a simple WebDAV client like `curl`: # Write once: curl -k -T my-file.txt https://webdav.local.internxt.com:3005 # Read: curl -k https://webdav.local.internxt.com:3005/my-file.txt # Overwrite (this should not fail): curl -k -T my-file.txt https://webdav.local.internxt.com:3005 Note: I wrote this commit because otherwise the server from `internxt webdav enable` bugs with some WebDAV clients. [^1]: http://www.webdav.org/specs/rfc4918.html#put-resources
Hi again @adrienverge! |
The WebDAV specification 1 states that in case of a
PUT /…/file
, if the resource/…/file
already exists and is not a collection (= a directory), then it should be replaced in place (= overwritten).This commit fixes that.
It can be tested with a simple WebDAV client like
curl
:Note: I wrote this commit because otherwise the server from
internxt webdav enable
bugs with some WebDAV clients.Footnotes
http://www.webdav.org/specs/rfc4918.html#put-resources ↩