> Hi Ivan,
>
> I can't reproduce your problem. As you can see from the last line of
> your patch, the escaped pathnames are compared not the unescaped ones.
Ahhh... apologies to everyone, I should have looked more carefully.
I fixed this many moons ago, and when I worked on it there were no
getEscapedPath() calls, they were introduced only 2 revisions ago (in 1.67, end
of July). Before it was only getPath(), which was causing problems if the URL
contained spaces or any other "reserved" characters (according to RFC 2068,
section 3.2.1), and my fix worked then. I blindly assumed there were no changes
to this part of the code since then.
But introducing getEscapedPath() in revision 1.67 only partially fixed the
problem; it fixes the case with spaces, but it breaks if you have a collection
with dashes or undescores, as James experienced. Now, the reason for this latest
breakage is apparently a bug in org.apache.slide.uril.HttpURL.getEscapedPath(),
which escapes more characters then it needs to (dash and underscore are safe
characters according to RFC 2068).
Here is my updated patch:
diff -u -r1.69 WebdavResource.java
--- src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java
+++ src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java
@@ -918,9 +918,10 @@
boolean itself = false;
String href = response.getHref();
+ href = org.apache.util.URIUtil.unescape(href);
if (!href.startsWith("/"))
- href = HttpURL.getEscapedPath(href);
- String httpURLPath = httpURL.getEscapedPath();
+ href = HttpURL.getPath(href);
+ String httpURLPath = httpURL.getPath();
int compared = httpURLPath.compareTo(href);
// Compare with the href path and requested-path itself.
if (compared == 0 || compared == -1 && href.endsWith("/") ||
Basically, we normalize both httpURLPath and href to unescaped form before
comparing them.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]