Skip to content

A free, self-hostable news aggregator…

HTML+XPath fallback to feed title (#4288)

Alexandre Alapetite954cc0510d77
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 30e2e7bd4..e0d26046b 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -601,7 +601,8 @@ class FreshRSS_Feed extends Minz_Model {
$doc->strictErrorChecking = false;
$doc->loadHTML($html, LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNING);
$xpath = new DOMXPath($doc);
- $view->rss_title = $xPathFeedTitle == '' ? '' : htmlspecialchars(@$xpath->evaluate('normalize-space(' . $xPathFeedTitle . ')'), ENT_COMPAT, 'UTF-8');
+ $view->rss_title = $xPathFeedTitle == '' ? $this->name() :
+ htmlspecialchars(@$xpath->evaluate('normalize-space(' . $xPathFeedTitle . ')'), ENT_COMPAT, 'UTF-8');
$view->rss_base = htmlspecialchars(trim($xpath->evaluate('normalize-space(//base/@href)')), ENT_COMPAT, 'UTF-8');
$nodes = $xpath->query($xPathItem);
if (empty($nodes)) {