Skip to content

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

Bugfix for getCachePath(URL url)

borg-0300139ba4e0c8ca
diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java
index 14d8e1117..37f06ffd7 100644
--- a/source/de/anomic/plasma/plasmaHTCache.java
+++ b/source/de/anomic/plasma/plasmaHTCache.java
@@ -528,14 +528,21 @@ public final class plasmaHTCache {
if (!path.startsWith("/")) { path = "/" + path; }
if (path.endsWith("/") && query == null) { path = path + "ndx"; }
- Pattern pathPattern = Pattern.compile("/\\.\\./");
- Matcher matcher = pathPattern.matcher(path);
+ Pattern searchPattern = Pattern.compile("/\\.\\./");
+ Matcher matcher = searchPattern.matcher(path);
while (matcher.find()) {
path = matcher.replaceAll("/!!/");
matcher.reset(path);
}
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
int port = url.getPort();