Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) further improvements for the anomic.net.url class - relpath starting with javascript: are ignored now - bugfix for concatenation of relpath starting with # or ? in this case no slash should be added to the baseURL, otherwise we get URLs of the form http://test.de/index.html/?param=value

thelia70cbd959b56
diff --git a/source/de/anomic/net/URL.java b/source/de/anomic/net/URL.java
index 2281cd291..7b009c80e 100644
--- a/source/de/anomic/net/URL.java
+++ b/source/de/anomic/net/URL.java
@@ -86,8 +86,14 @@ public class URL {
this.protocol = baseURL.protocol;
this.host = baseURL.host;
this.port = baseURL.port;
- if (relPath.startsWith("/")) this.path = relPath;
- else this.path = (baseURL.path.endsWith("/")) ? (baseURL.path + relPath) : (baseURL.path + "/" + relPath);
+ if (relPath.toLowerCase().startsWith("javascript:")) this.path = baseURL.path;
+ else if (relPath.startsWith("/")) this.path = relPath;
+ else {
+ if (relPath.startsWith("#") ||
+ relPath.startsWith("?") ||
+ baseURL.path.endsWith("/")) this.path = baseURL.path + relPath;
+ else this.path = baseURL.path + "/" + relPath;
+ }
this.quest = baseURL.quest;
this.ref = baseURL.ref;