fix #1104 ignore empty content

This commit is contained in:
Shinsuke Sugaya 2017-06-12 22:45:43 +09:00
parent 58563b4bc2
commit 144518a811

View file

@ -694,18 +694,24 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
// meta thumbnail
final Node thumbnailNode = getXPathAPI().selectSingleNode(document, META_NAME_THUMBNAIL_CONTENT);
if (thumbnailNode != null) {
final URL thumbnailUrl = getURL(responseData.getUrl(), thumbnailNode.getTextContent());
if (thumbnailUrl != null) {
return thumbnailUrl.toExternalForm();
final String content = thumbnailNode.getTextContent();
if (StringUtil.isNotBlank(content)) {
final URL thumbnailUrl = getURL(responseData.getUrl(), content);
if (thumbnailUrl != null) {
return thumbnailUrl.toExternalForm();
}
}
}
// meta og:image
final Node ogImageNode = getXPathAPI().selectSingleNode(document, META_PROPERTY_OGIMAGE_CONTENT);
if (ogImageNode != null) {
final URL thumbnailUrl = getURL(responseData.getUrl(), ogImageNode.getTextContent());
if (thumbnailUrl != null) {
return thumbnailUrl.toExternalForm();
final String content = ogImageNode.getTextContent();
if (StringUtil.isNotBlank(content)) {
final URL thumbnailUrl = getURL(responseData.getUrl(), content);
if (thumbnailUrl != null) {
return thumbnailUrl.toExternalForm();
}
}
}