From a70cbd959b56858597c0d246afd66d66e16675ba Mon Sep 17 00:00:00 2001 From: theli Date: Tue, 18 Jul 2006 05:12:08 +0000 Subject: [PATCH] *) 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 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2298 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/net/URL.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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;