webdav-fs icon indicating copy to clipboard operation
webdav-fs copied to clipboard

readdir includes parent path name when not mounted on root

Open Cobertos opened this issue 2 years ago • 4 comments

When pairing readdir with cors-anywhere, I seem to be getting unexpected results. It's the same behavior as #56 but it only happens when I proxy requests through cors-anywhere.

I modified the repo in #56 to produce the unexpected results. You can find the reproduction in https://github.com/Cobertos/webdav-fs

npm install
node server_webdav.js &
node client_webdav.js

Cobertos avatar Jun 06 '22 06:06 Cobertos

It seems that this is occurs without cors-anywhere, you just have to mount the webdav server not on the root domain, but on a path of it.

I updated the repro with a server mounted on /somewhere and it exhibits the same behavior as #56

Cobertos avatar Jun 08 '22 05:06 Cobertos

Thanks for this! Unfortunately I don't have time right now to dig into it, but have you checked if your issue is reproducible on the parent webdav project?

I'd also happily accept a PR addressing this.

perry-mitchell avatar Jun 11 '22 18:06 perry-mitchell

Yes, it does look like it happens with the parent repo. I pushed a commit to use webdav and .getDirectoryContents() directly and I see the duplicated entry

I will take a stab at a PR

Cobertos avatar Oct 19 '22 04:10 Cobertos

Made a PR, see https://github.com/perry-mitchell/webdav-client/pull/324 . Turns out it was not where I mounted the webdav server, but just that my calls were not using the leading /, like all the ones in the webdav-client repo tests are.

Cobertos avatar Oct 19 '22 04:10 Cobertos