Sfoglia il codice sorgente

Fix XPath for HTML documents with broken root (#6774)

fix https://github.com/FreshRSS/FreshRSS/issues/6773

The default `.//` prefix for the XPath does not to work for documents, which have content after the end of their main node
Alexandre Alapetite 1 anno fa
parent
commit
91d0e5099b
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      app/Models/Entry.php

+ 1 - 1
app/Models/Entry.php

@@ -785,7 +785,7 @@ HTML;
 			$content = '';
 			$cssSelector = htmlspecialchars_decode($feed->pathEntries(), ENT_QUOTES);
 			$cssSelector = trim($cssSelector, ', ');
-			$nodes = $xpath->query((new Gt\CssXPath\Translator($cssSelector))->asXPath());
+			$nodes = $xpath->query((new Gt\CssXPath\Translator($cssSelector, '//'))->asXPath());
 			if ($nodes != false) {
 				$path_entries_filter = $feed->attributeString('path_entries_filter') ?? '';
 				$path_entries_filter = trim($path_entries_filter, ', ');