From 544919316707fc19556c74d7a8a61178028d39da Mon Sep 17 00:00:00 2001 From: borg-0300 Date: Mon, 9 Jan 2006 23:19:05 +0000 Subject: [PATCH] bugfix for http://www.yacy-forum.de/viewtopic.php?t=1706 (i hope) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1304 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/plasmaHTCache.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java index 0a85f566f..5c8ebd57a 100644 --- a/source/de/anomic/plasma/plasmaHTCache.java +++ b/source/de/anomic/plasma/plasmaHTCache.java @@ -520,19 +520,19 @@ public final class plasmaHTCache { */ public File getCachePath(URL url) { // this.log.logFinest("plasmaHTCache: getCachePath: IN=" + url.toString()); - String remotePath = url.getFile(); - if (!remotePath.startsWith("/")) { remotePath = "/" + remotePath; } - if (remotePath.endsWith("/")) { remotePath = remotePath + "ndx"; } + String path = url.getPath(); + String query = url.getQuery().replaceAll("[\"\\/:*?<>|]", "_"); // yes this is not reversible, but that is not needed (really?) + if (!path.startsWith("/")) { path = "/" + path; } + if (path.endsWith("/") && query == null) { path = path + "ndx"; } Pattern pathPattern = Pattern.compile("/\\.\\./"); - Matcher matcher = pathPattern.matcher(remotePath); + Matcher matcher = pathPattern.matcher(path); while (matcher.find()) { - remotePath = matcher.replaceAll("/!!/"); - matcher.reset(remotePath); + path = matcher.replaceAll("/!!/"); + matcher.reset(path); } - remotePath = remotePath.replaceAll("[?&:!]", "_"); // yes this is not reversible, but that is not needed -// remotePath = remotePath.replaceAll("[\"\\/:*?<>|]", "_"); // yes this is not reversible, but that is not needed - + if (query != null) { path = path.concat("_").concat(query); } + // only set NO default ports int port = url.getPort(); String protocol = url.getProtocol(); @@ -547,9 +547,9 @@ public final class plasmaHTCache { protocol = "yacy"; } if (port < 0) { - return new File(this.cachePath, protocol + "/" + url.getHost() + remotePath); + return new File(this.cachePath, protocol + "/" + url.getHost() + path); } else { - return new File(this.cachePath, protocol + "/" + url.getHost() + "!" + port + remotePath); + return new File(this.cachePath, protocol + "/" + url.getHost() + "!" + port + path); } /* File path; if (port < 0) {