You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Constantine Vetoshev <ge...@yahoo.com> on 2005/10/05 19:06:35 UTC

[PATCH] MacroImpl.java sometimes tries to access URLs with multiple repeating slashes

I'm working with the 2.1 release version, and I noticed that moveMethod
calls fail when I rename directories which have children with
permission lists of their own. After taking a look, I noticed that
MacroImpl's copyObject method, in copying the object's children,
blindly concatenates two Strings, destinationUri and childUri. This
often results in URLs that look like 'destinationUri//childUri', but
does not break unless subdirectories have permission lists. I did not
try to investigate why this happens in some cases but not in others,
and just hacked around it. A patch against the 2.1 version of
MacroImpl.java follows:


Index: MacroImpl.java
===================================================================
--- MacroImpl.java      (2.1 release version)
+++ MacroImpl.java      (working copy)
@@ -711,6 +711,10 @@
             if (parameters.isRecursive()) {
                 while(sourceNodeChildren.hasMoreElements()) {
                     String childUri = (String)
sourceNodeChildren.nextElement();
+                    // HACK: There can be at most one slash between
the destinationUri and the childUri:
+                    // Otherwise, a request goes out against a URL
with multiple slashes.
+                    if (destinationUri.endsWith("/") &&
childUri.startsWith("/"))
+                        childUri = childUri.substring(1);
                     String childDestinationUri = destinationUri +
childUri
                         .substring(sourceNode.getUri().length());
                     copyObject(token, childUri, childDestinationUri,



		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org