Skip to content

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

*) Bugfix: supportedFileExt Function didn't detect the file extension correctly if there was a dot in one of the parent directories of the file.

theli8a33c9b3092d
diff --git a/source/de/anomic/plasma/plasmaParser.java b/source/de/anomic/plasma/plasmaParser.java
index 650c75b37..3db3e0d84 100644
--- a/source/de/anomic/plasma/plasmaParser.java
+++ b/source/de/anomic/plasma/plasmaParser.java
@@ -257,6 +257,14 @@ public final class plasmaParser {
}
}
+ public static boolean supportedContent(URL url, String mimeType) {
+ return supportedMimeTypesContains(mimeType) && supportedFileExt(url);
+ }
+
+ public static boolean supportedRealTimeContent(URL url, String mimeType) {
+ return realtimeParsableMimeTypesContains(mimeType) && supportedFileExt(url);
+ }
+
public static boolean supportedMimeTypesContains(String mimeType) {
mimeType = getRealMimeType(mimeType);
@@ -270,13 +278,23 @@ public final class plasmaParser {
}
public static boolean supportedFileExt(URL url) {
+ // getting the file path
String name = url.getFile();
+
+ // chopping http parameters from the url
int p = name.lastIndexOf('?');
if (p != -1) {
name = name.substring(0,p);
}
+
+ // tetermining last position of / in the file path
+ p = name.lastIndexOf('/');
+ if (p != -1) {
+ name = name.substring(p);
+ }
- p = name.lastIndexOf('.');
+ // termining last position of . in file path
+ p = (p != -1) ? name.lastIndexOf('.',p) : name.lastIndexOf('.');
if (p < 0) return true; // seams to be strange, but this is a directory entry or default file (html)
return supportedFileExtContains(name.substring(p + 1));
}