Skip to content
This repository

PROPFIND xml doesn't have encoded uri's #6

Closed
mkolve opened this Issue August 13, 2012 · 30 comments

6 participants

mkolve Roman Arutyunyan Javier Martínez Isern Palaus Bart van Bragt ako673de
mkolve

Directory "foo" contains file "a test"

with nginx-dav-ext-module,
curl 'http://foobar:8000/foo' -XPROPFIND
returns

<D:href>/foo/a test</D:href>

This should be escaped according to the rfc
http://tools.ietf.org/html/rfc4918#section-8.3.1

apache returns encoded uri's

<D:href>/foo/a%20test</D:href>
Isern Palaus
ipalaus commented May 29, 2013

Please, fix this!

Roman Arutyunyan
Owner
arut commented May 29, 2013

Please try uri-encode branch. If it works I'll merge into into master.

Roman Arutyunyan
Owner
arut commented May 29, 2013

That was github trouble. Please try again.

Javier Martínez

Not working yet. I am getting:

PROPFIND / HTTP/1.1
XML parse error at line 42: not well-formed (invalid token)

Where line 42 is: <D:href>/Versions%2032%20%26%2064%20BitP</D:href> and the real name of the dir is Versions 32 & 64 Bits

Roman Arutyunyan
Owner
arut commented May 29, 2013

Updated. Please try again.

Javier Martínez

Same kind of error, but this time with:
<D:href>/The%20Oscar%20Peterson%20Trio%20-%20Night%20Test%20(1962)%20[foo][baar%20320][h33t][sc<98>I<EF>^A^@^@</D:href>

which real name is Test (1962) [foo][baar 320][h33t][schon55]

I think that square brackets also need an escape

Roman Arutyunyan
Owner
arut commented May 29, 2013

Updated. Please try again.

Javier Martínez

Ok, we did a progress :)

Now I am not getting errors anymore, but I can't see files/folders with square brackets. They just are not showed in my WebDAV client. I paste you a tcpdump of the server's XML response:

<D:href>/Transmit/Test%20(1962)%20[foo][baar%20320][h33t][schon55]</D:href>
<D:propstat>
<D:prop>
<D:creationdate>2013-05-29T14:04:09Z</D:creationdate>
<D:displayname>Test (1962) [foo][baar 320][h33t][schon55]</D:displayname>

This folder, for example, is not being showed, as you can see http://drop.difun.de/2013_05_29_163517.png

Javier Martínez

For your information, I tested with Apache and it works fine. Then, I did a tcpdump and I can see that Apache escape square brackets [ with %5B and ] with %5D. Thanks you!

Roman Arutyunyan
Owner
arut commented May 30, 2013

That's helpful, thanks.

Roman Arutyunyan
Owner
arut commented May 30, 2013

Could you post parts of that tcpdump here? I need encoding examples for your folders with lots of bad characters.

Javier Martínez

That's the only issue that I have found. Square brackets. I give you an example of tcpdump for Apache:

<D:href>/Transmit/%5bNon-showable%20%5dfile</D:href>

As you can see, is a file with name [Non-showable ]file

To sum up, I think the only you need to solve is just this: square brackets enconding :)

Roman Arutyunyan
Owner
arut commented May 30, 2013
  • What's in displayname in this case?
  • Please provide the result for a name with the ampersand &
Javier Martínez

Nginx result for a name with ampersand &, but this is showed RIGHTLY in my webdav client. No issues with it

<D:href>/Transmit/&amp;test_ampersand_file</D:href>
<D:propstat>
<D:prop>
<D:creationdate>2013-05-30T14:42:43Z</D:creationdate>
<D:displayname>&amp;test_ampersand_file</D:displayname>
<D:getcontentlanguage/>
<D:getcontentlength>0</D:getcontentlength>
<D:getcontenttype/>
<D:getetag/>
<D:getlastmodified>Thu, 30 May 2013 14:42:22 GMT</D:getlastmodified>
<D:lockdiscovery/>
<D:resourcetype/>
<D:source/>
<D:supportedlock/>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>

Nginx results for a name with square backets. This is not showed in my Webdav client:

<D:href>/Transmit/[Non-showable%20]file</D:href>
<D:propstat>
<D:prop>
<D:creationdate>2013-05-23T07:36:43Z</D:creationdate>
<D:displayname>[Non-showable ]file</D:displayname>
<D:getcontentlanguage/>
<D:getcontentlength>0</D:getcontentlength>
<D:getcontenttype/>
<D:getetag/>
<D:getlastmodified>Thu, 23 May 2013 07:36:43 GMT</D:getlastmodified>
<D:lockdiscovery/>
<D:resourcetype/>
<D:source/>
<D:supportedlock/>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
Roman Arutyunyan
Owner
arut commented May 30, 2013

Please try new.

Javier Martínez

You almost did it!! :+1:

I can see that files/folders, but if is a folder I can't view its content. I mean, I have the folder Test (1962) [foo][baar 320][h33t][schon55] which has a dummyFile inside. I can't see that dummyFile. I paste you the whole dump:

Dump before of chdir

<D:response>
<D:href>/Transmit/Test%20%281962%29%20%5bfoo%5d%5bbaar%20320%5d%5bh33t%5d%5bschon55%5d</D:href>
<D:propstat>
<D:prop>
<D:creationdate>2013-05-30T15:25:13Z</D:creationdate>
<D:displayname>Test%20%281962%29%20%5bfoo%5d%5bbaar%20320%5d%5bh33t%5d%5bschon55%5d</D:displayname>
<D:getcontentlanguage/>
<D:getcontentlength>4096</D:getcontentlength>
<D:getcontenttype/>
<D:getetag/>
<D:getlastmodified>Thu, 30 May 2013 15:25:1
</D:getlastmodified>
<D:lockdiscovery/>
<D:resourcetype><D:collection/></D:resourcetype>
<D:source/>
<D:supportedlock/>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>

Whole dump, after chdir to Test (1962) [foo][baar 320][h33t][schon55]

<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:">

<D:response>
<D:href>/Transmit/Test%20(1962)%20[foo][baar%20320][h33t][schon55]/</D:href>
<D:propstat>
<D:prop>
<D:creationdate>2013-05-30T15:25:13Z</D:creationdate>
<D:displayname></D:displayname>
<D:getcontentlanguage/>
<D:getcontentlength>4096</D:getcontentlength>
<D:getcontenttype/>
<D:getetag/>
<D:getlastmodified>Thu, 30 May 2013 15:25:13 GMT</D:getlastmodified>
<D:lockdiscovery/>
<D:resourcetype><D:collection/></D:resourcetype>
<D:source/>
<D:supportedlock/>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>

<D:response>
<D:href>/Transmit/Test (1962) [foo][baar 320][h33t][schon55]/dummyFile</D:href>
<D:propstat>
<D:prop>
<D:creationdate>2013-05-30T15:25:13Z</D:creationdate>
<D:displayname>dummyFile</D:displayname>
<D:getcontentlanguage/>
<D:getcontentlength>4</D:getcontentlength>
<D:getcontenttype/>
<D:getetag/>
<D:getlastmodified>Thu, 30 May 2013 15:24:11 GMT</D:getlastmodified>
<D:lockdiscovery/>
<D:resourcetype/>
<D:source/>
<D:supportedlock/>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>

</D:multistatus>

As you can see, the "second one" does not have the square brackets encoded

Javier Martínez

I just updated the previous comment with a previous chdir dump. I hope this helps you!

Roman Arutyunyan
Owner
arut commented May 30, 2013

Please try now!

Javier Martínez

That's it!!!! Thanks you dude ;)

Bart van Bragt

I had some issues with Omnifocus not being able to use an Nginx Webdav server for syncing. The problems were related to URI-encoding, the version in the uri-encode branch fixed this for me. Great work!

Would be fantastic if this branch could be merged with the master branch.

ako673de

I seem to have a very similar problem (with german "Umlaute" and the whitespace). My question: There are three branches of this module: lock, master and uri-encode. What if I also need the lock-extension? Are there any disadvantages of uri-encode with respect to master? Or will I have to merge them all by myself?

ako673de

OK. The fix works for me, too! Now CyberDuck and Netdrive show all files and folders correctly! IMO the uri-encode branch (of user semantico, who fixed something with the content-header) should be merged to master of arut's repository.

Off topic: Did anyone notice, that nginx 1.5.6 seems to have a similar bug in the implementation of the MOVE and COPY methods?

BTW: I also checked the "lock" branch. What's the status of that one? Is there an easy way to merge the lock-specific functions to master? I didn't find an easy way to do this myself...

Javier Martínez
Roman Arutyunyan
Owner

merged

Roman Arutyunyan arut closed this December 07, 2013
Roman Arutyunyan
Owner

@ako673de lock is not finished. I have no time and Mac for that. Most software does not need locking.

ako673de

Please better merge with "semantico"s latest version. He fixed something with the xml content header...

For me the lock features become interesting, if I e.g. would want to replace "editgrid" (which is a coop site that announced that it will shut down next May)...

Maybe somebody else might want to continue the programming? But I think that the lock branch is already too far away from the master. Maybe you should at least remove all not "lock" related code and name it differently (so that users need another config command to activate it).

Roman Arutyunyan
Owner

@ako673de thanks, I will fix xml-related stuff.

Lock branch is not far from master. It's still possible to finish the work.

BTW another great advantage of lock is git-over-nginx which is not possible now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.