Browse Source

CSS selector trim (#6428)

fix https://github.com/FreshRSS/FreshRSS/pull/6426#issuecomment-2091159868
Alexandre Alapetite 1 year ago
parent
commit
fd7157e40c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      app/Models/Entry.php

+ 4 - 2
app/Models/Entry.php

@@ -749,11 +749,13 @@ HTML;
 
 			$content = '';
 			$cssSelector = htmlspecialchars_decode($feed->pathEntries(), ENT_QUOTES);
+			$cssSelector = trim($cssSelector, ', ');
 			$nodes = $xpath->query((new Gt\CssXPath\Translator($cssSelector))->asXPath());
 			if ($nodes != false) {
-				$path_entries_filter = $feed->attributeString('path_entries_filter');
+				$path_entries_filter = $feed->attributeString('path_entries_filter') ?? '';
+				$path_entries_filter = trim($path_entries_filter, ', ');
 				foreach ($nodes as $node) {
-					if ($path_entries_filter != null) {
+					if ($path_entries_filter !== '') {
 						$filterednodes = $xpath->query((new Gt\CssXPath\Translator($path_entries_filter))->asXPath(), $node) ?: [];
 						foreach ($filterednodes as $filterednode) {
 							if ($filterednode->parentNode === null) {