[freenet-cvs] r20948 - in trunk/freenet/src/freenet: clients/http/filter support

nextgens at freenetproject.org nextgens at freenetproject.org
Thu Jul 3 03:58:26 UTC 2008


Author: nextgens
Date: 2008-07-03 03:58:26 +0000 (Thu, 03 Jul 2008)
New Revision: 20948

Modified:
   trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
   trunk/freenet/src/freenet/support/URIPreEncoder.java
Log:
Hopefully fix bug #2451: "Could not parse own URI" on anarchophiles

it might have side effects; please TEST IT!

Modified: trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java	2008-07-03 03:56:01 UTC (rev 20947)
+++ trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java	2008-07-03 03:58:26 UTC (rev 20948)
@@ -75,6 +75,11 @@
 	}
 	
 	public String processURI(String u, String overrideType, boolean noRelative, boolean inline) throws CommentException {
+		if(u.matches("^#[a-zA-Z0-9-_]+$")) {
+			// Hack for anchors, see #710
+			return u;
+		}
+		
 		URI uri;
 		URI resolved;
 		boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
@@ -110,9 +115,6 @@
 					url = url+"&hasAnActivelink=true";
 				}
 				return url;
-			}else if(path.equals("") && uri.toString().matches("^#[a-zA-Z0-9-_]+$")){
-				// Hack for anchors, see #710
-				return uri.toString();
 			}
 		}
 		

Modified: trunk/freenet/src/freenet/support/URIPreEncoder.java
===================================================================
--- trunk/freenet/src/freenet/support/URIPreEncoder.java	2008-07-03 03:56:01 UTC (rev 20947)
+++ trunk/freenet/src/freenet/support/URIPreEncoder.java	2008-07-03 03:58:26 UTC (rev 20948)
@@ -19,7 +19,7 @@
 public class URIPreEncoder {
 	
 	// We deliberately include '%' because we don't want to interfere with stuff which is already encoded.
-	public final static String allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-!.~'()*,;:$&+=?/@%#";
+	public final static String allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-!.~'()*,;:$&+=?/@%";
 
 	public static String encode(String s) {
 		StringBuffer output = new StringBuffer(s.length()*2);




More information about the cvs mailing list