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

URI.pathname not prepended to destination path in move() and copy(). #10

Open
btimby opened this issue Apr 6, 2020 · 0 comments
Open

Comments

@btimby
Copy link

btimby commented Apr 6, 2020

If you are using the webdav client with a url such as...

const client = webdav.Connection({ url: 'http://myserver.com/webdav' ");

And you try to perform a move operation like...

client.move('/foobar', '/barfoo')

You receive a 404 error because on the server side:
https://github.com/OpenMarshal/npm-WebDAV-Server/blob/ca245a2208070fde0bfc8f2610bbcd375fad1eb4/src/server/v2/commands/Move.ts#L22

Source path is '/webdav/foobar' while destination is '/barfoo'. The leading path (root) is included in the source because it is relative to the URI ('http://myserver.com/webdav') while the destination is not.

I feel like this is a bug in the client and that it is inconsistent in how it handles paths. This situation requires the user to prepend the root path to the destination when using move() or copy(). All other operations use relative paths (as it should be).

This could be "fixed" fairly easily in the client...
https://github.com/OpenMarshal/npm-WebDAV-Client/blob/master/src/index.ts#L373

... by prepending this.root to pathDestination. Or by passing the destination as a full URI (relative to the connection base URI), in which case it would be parsed server-side and also be handled correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant