Răsfoiți Sursa

HTML+XPath fallback to feed title (#4288)

* HTML+XPath fallback to feed title
Except when adding the feed, the following refreshes should fallback to feed title when generating the internal RSS representation.
Improvement of https://github.com/FreshRSS/FreshRSS/pull/4220
Alexandre Alapetite 4 ani în urmă
părinte
comite
954cc0510d
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      app/Models/Feed.php

+ 2 - 1
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)) {