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

Name decoding is broken for already encoded characters. #93

Closed
pschupp01 opened this issue Apr 30, 2018 · 4 comments
Closed

Name decoding is broken for already encoded characters. #93

pschupp01 opened this issue Apr 30, 2018 · 4 comments

Comments

@pschupp01
Copy link

pschupp01 commented Apr 30, 2018

I was facing this issue today, and managed to implement a simple failing test.

If a directory has a name containing encoded character it will fail to get the correct directory name.

I have added a directory with name two%20words, containing a single file.
And testing getDirectoryContents on this folder.

Step to reproduce:
• Add ./test/serverContents/two%20words/file2.txt
• Add the following test in getDirectoryContents.spec.js

   it("returns only the directory content when encoded special characters in name", function() {
     return this.client.getDirectoryContents("/two%20words").then(function(contents) {
         console.log(contents);
         expect(contents).to.have.lengthOf(1);
         expect(contents[0].basename).to.equal("file2.txt");
     });
 });

• npm t

@perry-mitchell
Copy link
Owner

Thanks @pschupp01! This helps alot :)

@perry-mitchell
Copy link
Owner

Added the failing test here: #94

Will try to address both this and #91

@perry-mitchell
Copy link
Owner

It's weird though, because it requests the correct URL: http://localhost:9988/webdav/server/two%2520words, but the result is wrong. The result should contain contents that include file2.txt, but instead I get http://localhost:9988/webdav/server/two%20words/file.txt in the response.. Looks like the server might be treating this incorrectly as well.

@perry-mitchell
Copy link
Owner

perry-mitchell commented May 1, 2018

It looks like the decoding done on the filenames when the response is received is breaking the process.

EDIT: To be honest, I'm not quite sure where to start with this. It seems that both my test server and home server serve similar results - They decode themselves and the %20 encoding is ignored. Would be happy for someone to take a look at this.

silto added a commit to silto/webdav-client that referenced this issue May 3, 2018
Fixes path decoding on file paths like "text%20folder" by removing useless decodings.
perry-mitchell added a commit that referenced this issue Jul 6, 2018
Fix special character issue (#93)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants