Bugfix for getCachePath(URL url)

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

@ -99,7 +99,6 @@ public final class plasmaHTCache {
this.log = new serverLog("HTCACHE"); this.log = new serverLog("HTCACHE");
this.cachePath = htCachePath; this.cachePath = htCachePath;
this.maxCacheSize = maxCacheSize;
// reset old HTCache ? // reset old HTCache ?
final String[] list = cachePath.list(); final String[] list = cachePath.list();
@ -534,6 +533,15 @@ public final class plasmaHTCache {
path = matcher.replaceAll("/!!/"); path = matcher.replaceAll("/!!/");
matcher.reset(path); matcher.reset(path);
} }
if (path != null) {
// yes this is not reversible, but that is not needed
searchPattern = Pattern.compile("(\"|\\\\|\\*|\\?|:|<|>|\\|)");
matcher = searchPattern.matcher(path);
while (matcher.find()) {
path = matcher.replaceAll("_");
matcher.reset(path);
}
}
if (query != null) { if (query != null) {
// yes this is not reversible, but that is not needed // yes this is not reversible, but that is not needed
searchPattern = Pattern.compile("(\"|\\\\|\\*|\\?|/|:|<|>|\\|)"); searchPattern = Pattern.compile("(\"|\\\\|\\*|\\?|/|:|<|>|\\|)");
@ -664,6 +672,8 @@ public final class plasmaHTCache {
public final class Entry { public final class Entry {
public static final int MAXLENGTH = 255;
// the class objects // the class objects
public Date initDate; // the date when the request happened; will be used as a key public Date initDate; // the date when the request happened; will be used as a key
public int depth; // the depth of prefetching public int depth; // the depth of prefetching
@ -801,7 +811,7 @@ public final class plasmaHTCache {
// we cannot match that here in the cache file path and therefore omit writing into the cache // we cannot match that here in the cache file path and therefore omit writing into the cache
if (this.cacheFile.getParentFile().isFile() || this.cacheFile.isDirectory()) { return "path_ambiguous"; } if (this.cacheFile.getParentFile().isFile() || this.cacheFile.isDirectory()) { return "path_ambiguous"; }
if (this.cacheFile.toString().indexOf("..") >= 0) { return "path_dangerous"; } if (this.cacheFile.toString().indexOf("..") >= 0) { return "path_dangerous"; }
if (this.cacheFile.getAbsolutePath().length() > 250) { return "path too long"; } if (this.cacheFile.getAbsolutePath().length() > MAXLENGTH) { return "path too long"; }
// -CGI access in request // -CGI access in request
// CGI access makes the page very individual, and therefore not usable in caches // CGI access makes the page very individual, and therefore not usable in caches

Loading…
Cancel
Save