git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1304 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 19 years ago
parent 2a23f5d419
commit 5449193167

@ -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) {

Loading…
Cancel
Save