Display result favicons only for http or https resources.

Favicon display only makes sense for http(s) websites, being public or
intranet. So I modified the favicon conditional display to verify the
result URL protocol rather than if we are in intranet mode.

Also prevented rendering an img HTML tag with empty src on other results
protocols such as ftp or file.

Fixing this thanks to priest2 report
(http://forum.yacy-websuche.de/viewtopic.php?f=23&t=5923).
pull/105/head
luccioman 8 years ago
parent 4c9be29a55
commit 52d05d14c6

@ -1,7 +1,9 @@
#(content)#::
<div class="searchresults">
<h4 class="linktitle">
<img width="16" height="16" src="#[faviconUrl]#" id="f#[urlhash]#" class="favicon" style="width:16px; height:16px;" alt="" />
#(favicon)#::
<img width="16" height="16" src="#[faviconUrl]#" id="f#[urlhash]#" class="favicon" style="width:16px; height:16px;" alt="" />
#(/favicon)#
<a href="#[link]#" target="#[target]#">#[title]#</a></h4>
<div class="urlactions">
#(heuristic)#::

@ -184,10 +184,15 @@ public class yacysearchitem {
String resultFileName = resultURL.getFileName();
prop.putHTML("content_target", target);
DigestURL faviconURL = null;
if ((fileType == FileType.HTML || fileType == FileType.JSON) && !sb.isIntranetMode()) {
if ((fileType == FileType.HTML || fileType == FileType.JSON) && (resultURL.isHTTP() || resultURL.isHTTPS())) {
faviconURL = getFaviconURL(result, new Dimension(16, 16));
}
prop.putHTML("content_faviconUrl", processFaviconURL(ImageViewer.hasFullViewingRights(header, sb), faviconURL));
if(faviconURL == null) {
prop.put("content_favicon", 0);
} else {
prop.put("content_favicon", 1);
}
prop.putHTML("content_favicon_faviconUrl", processFaviconURL(ImageViewer.hasFullViewingRights(header, sb), faviconURL));
prop.put("content_urlhash", urlhash);
prop.put("content_ranking", Float.toString(result.score()));
Date[] events = result.events();

@ -9,7 +9,7 @@
"size": "#[size]#",
"sizename": "#[sizename]#",
"guid": "#[urlhash]#",
"faviconUrl": "#[faviconUrl]#",
#(favicon)#::"faviconUrl": "#[faviconUrl]#",#(/favicon)#
"host": "#[host]#",
"path": "#[path]#",
"file": "#[file]#",

Loading…
Cancel
Save