TheProjecter / sardine

Automatically exported from code.google.com/p/sardine
0 stars 0 forks source link

URISyntaxException is Thrown #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Calling list on any sharepoint site with spaces in document name or document 
folder.

What is the expected output? What do you see instead?
The folder/document.

What version of the product are you using?
314

On what operating system?
Windows 7

What webdav server are you hitting?
SharePoint

What is in the server error logs?

Please provide any additional information below (including code examples
and full stack traces with line numbers in them).

Original issue reported on code.google.com by kevin.we...@gmail.com on 14 Jun 2012 at 2:53

GoogleCodeExporter commented 9 years ago
Sharepoint is known to return illegal URIs that are not encoded.

Original comment by dkocher@sudo.ch on 21 Jun 2012 at 4:59

GoogleCodeExporter commented 9 years ago
I just encountered this issue as well, as my SharePoint server does indeed pass 
spaces unencoded in the path part of its "href" elements.  Fortunately nobody 
was here to see my eyes roll back in my head and hear the muttering.

However, there's a quick fix if anybody needs it. In the constructor for 
DavResource that takes a Response, instead of

        this.href = new URI(response.getHref());
use
        this.href = new URI(response.getHref().replace(" ", "%20"));

A similar change can obviously be made for the other constructor.

I was concerned about SP failing to encode other characters, like percent 
signs, but it doesn't appear to allow such characters in filenames at all, so 
they shouldn't occur in URLs.  

Given what I'd think would be a pretty low impact of such a change, and the 
wide deployment of SharePoint, it might be to Sardine's benefit to wince a bit 
and deal with the improper URLs rather than have the items with spaces simply 
be dropped from the directory list.

Original comment by jgarb...@gmail.com on 11 Dec 2012 at 1:48