*) Bugfix for not human readable content of PDFs while viewing the URL Content via GUI

- This Bug also affects the snippet generation on non html/text documents
   See: http://www.yacy-forum.de/viewtopic.php?t=1472

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1075 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 445e3a620f
commit bbb936b9ea

Binary file not shown.

@ -321,21 +321,34 @@ public class plasmaSnippetCache {
if (resource == null) return null; if (resource == null) return null;
httpHeader header = null; httpHeader header = null;
try { try {
header = cacheManager.getCachedResponse(plasmaURL.urlHash(url)); header = this.cacheManager.getCachedResponse(plasmaURL.urlHash(url));
} catch (IOException e) {} } catch (IOException e) {}
if (header == null) { if (header == null) {
String filename = cacheManager.getCachePath(url).getName(); String filename = this.cacheManager.getCachePath(url).getName();
int p = filename.lastIndexOf('.'); int p = filename.lastIndexOf('.');
if ((p < 0) || if (
((p >= 0) && (plasmaParser.supportedFileExtContains(filename.substring(p + 1))))) { (p < 0) ||
return parser.parseSource(url, "text/html", resource); ((p >= 0) && (plasmaParser.supportedFileExtContains(filename.substring(p + 1))))
) {
String supposedMime = "text/html";
// if the mimeType Parser is installed we can set the mimeType to null to force
// a mimetype detection
if (plasmaParser.supportedMimeTypesContains("application/octet-stream")) {
supposedMime = null;
} else if (p != -1){
// otherwise we try to determine the mimeType per file Extension
supposedMime = plasmaParser.getMimeTypeByFileExt(filename.substring(p + 1));
}
return this.parser.parseSource(url, supposedMime, resource);
} else { } else {
return null; return null;
} }
} else { } else {
if (plasmaParser.supportedMimeTypesContains(header.mime())) { if (plasmaParser.supportedMimeTypesContains(header.mime())) {
return parser.parseSource(url, header.mime(), resource); return this.parser.parseSource(url, header.mime(), resource);
} else { } else {
return null; return null;
} }

Loading…
Cancel
Save