Author: toad
Date: 2007-10-25 18:42:33 +0000 (Thu, 25 Oct 2007)
New Revision: 15565
Modified:
trunk/freenet/src/freenet/keys/FreenetURI.java
Log:
fix encoded colons
Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java 2007-10-25 18:27:31 UTC
(rev 15564)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java 2007-10-25 18:42:33 UTC
(rev 15565)
@@ -221,6 +221,10 @@
} else
URI = URI.trim();
+ if(URI.startsWith("freenet:")) {
+ URI = URI.substring("freenet:".length());
+ }
+
if(URI.indexOf('@') < 0 || URI.indexOf('/') < 0) {
// Encoded URL?
try {
@@ -233,19 +237,12 @@
// Strip http:// prefix
URI = URI.replaceFirst("^http://[^/]+/+","");
- // check scheme
- int colon = URI.indexOf(':');
- if ((colon != -1)
- && !URI.substring(0,
colon).equalsIgnoreCase("freenet")) {
- throw new MalformedURLException("Invalid scheme for
Freenet URI");
- }
-
// decode keyType
int atchar = URI.indexOf('@');
if (atchar == -1) {
throw new MalformedURLException("There is no @ in that
URI! ("+URI.toString()+')');
} else {
- keyType = URI.substring(colon + 1,
atchar).toUpperCase().trim();
+ keyType = URI.substring(0, atchar).toUpperCase().trim();
}
URI = URI.substring(atchar + 1);