TheProjecter / sardine

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

URL encoding problem (spaces in path) #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I didn't found way how to get content of directory which name contains spaces.

Example(1):
  sardine.getResources("https://dav.memopal.com/My Computers/");
Result(1):
  java.lang.IllegalArgumentException: Illegal character in path.

Example(2):
  sardine.getResources("https://dav.memopal.com/My%20Computers/");
Result(2):
  java.lang.StringIndexOutOfBoundsException: String index out of range: -2
  at com.googlecode.sardine.SardineImpl.getResources(SardineImpl.java:224)

I thing that problem could be solved in method SardineImpl.getResources(url). I 
don't know whether argument URL should be encoded or not. If yes, then 
comparing baseUrl should be on encoded URLs too (or both decoded). If no, then 
HttpPropFind constructor or executeWrapper should encode it.

regards
Kamil Tollinger

Original issue reported on code.google.com by kamil.to...@gmail.com on 18 Apr 2012 at 10:05

GoogleCodeExporter commented 9 years ago
What version of sardine are you using? I'm looking at latest trunk and 
SardineImpl.java:224 points at a return true, which couldn't possible throw 
that exception. ;-) 

You are correct though, you need to url encode your url.

Original comment by latch...@gmail.com on 18 Apr 2012 at 4:14

GoogleCodeExporter commented 9 years ago
This one:
http://mvnrepository.com/artifact/com.googlecode.sardine/sardine/146

Original comment by kamil.to...@gmail.com on 18 Apr 2012 at 5:16

GoogleCodeExporter commented 9 years ago
That is some ancient version that I have no idea about. The current repository 
version number is far far ahead of that number.

This dear friends is exactly why I recommend you stop using maven. You really 
can't be sure what you are getting from the repositories is a) correct and not 
tampered with and b) latest and greatest.

I have no idea how that jar got into that repository or what code is in it. 
Doesn't that scare you?

Original comment by latch...@gmail.com on 18 Apr 2012 at 5:27

GoogleCodeExporter commented 9 years ago
O.K.
Thank you for quick response and help. I already checked
current sources out and it seems that they are quite different.

So please sorry, for spending your time.

Original comment by kamil.to...@gmail.com on 18 Apr 2012 at 5:34