[freenet-cvs] r11223 - trunk/freenet/src/freenet/keys

toad at freenetproject.org toad at freenetproject.org
Mon Dec 4 16:13:04 UTC 2006


Author: toad
Date: 2006-12-04 16:13:02 +0000 (Mon, 04 Dec 2006)
New Revision: 11223

Modified:
   trunk/freenet/src/freenet/keys/FreenetURI.java
Log:
Decode before establishing key type.

Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java	2006-12-04 16:12:25 UTC (rev 11222)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java	2006-12-04 16:13:02 UTC (rev 11223)
@@ -216,6 +216,15 @@
 			throw new MalformedURLException("No URI specified");
 		}
 		
+		int percent = URI.indexOf('%');
+		int slash = URI.indexOf('/');
+		if((percent>-1) && ((percent<slash) || (slash<0))){ /* likely to be a copy/pasted url from a browser */
+			try{
+				URI=URLDecoder.decode(URI);
+			}catch(URLEncodedFormatException e){
+			}
+		}
+		
 		// check scheme
 		int colon = URI.indexOf(':');
 		if ((colon != -1)
@@ -243,15 +252,6 @@
 			URI = URI.substring(0, slash2);
 		}
 		
-		int percent = URI.indexOf('%');
-		int slash = URI.indexOf('/');
-		if((percent>-1) && ((percent<slash) || (slash<0))){ /* likely to be a copy/pasted url from a browser */
-			try{
-				URI=URLDecoder.decode(URI);
-			}catch(URLEncodedFormatException e){
-			}
-		}
-		
 		// sv is *backwards*
 		// this makes for more efficient handling
 		




More information about the cvs mailing list