Bugfix for getCachePath(URL url)

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

@ -528,14 +528,21 @@ public final class plasmaHTCache {
if (!path.startsWith("/")) { path = "/" + path; } if (!path.startsWith("/")) { path = "/" + path; }
if (path.endsWith("/") && query == null) { path = path + "ndx"; } if (path.endsWith("/") && query == null) { path = path + "ndx"; }
Pattern pathPattern = Pattern.compile("/\\.\\./"); Pattern searchPattern = Pattern.compile("/\\.\\./");
Matcher matcher = pathPattern.matcher(path); Matcher matcher = searchPattern.matcher(path);
while (matcher.find()) { while (matcher.find()) {
path = matcher.replaceAll("/!!/"); path = matcher.replaceAll("/!!/");
matcher.reset(path); matcher.reset(path);
} }
if (query != null) { if (query != null) {
path = path.concat("_").concat(query.replaceAll("[\"\\/:*?<>|]", "_")); // yes this is not reversible, but that is not needed // yes this is not reversible, but that is not needed
searchPattern = Pattern.compile("(\"|\\\\|\\*|\\?|/|:|<|>|\\|)");
matcher = searchPattern.matcher(query);
while (matcher.find()) {
query = matcher.replaceAll("_");
matcher.reset(query);
}
path = path.concat("_").concat(query);
} }
// only set NO default ports // only set NO default ports
int port = url.getPort(); int port = url.getPort();

Loading…
Cancel
Save