summaryrefslogtreecommitdiff
path: root/app/Models/Entry.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-11-30 21:17:45 +0100
committerGravatar GitHub <noreply@github.com> 2024-11-30 21:17:45 +0100
commitd89563ab404b933b07b8b10a9e32fcc9ee71357a (patch)
tree0017094d3a4269b5a777b6d7efbd85773a8a468c /app/Models/Entry.php
parenta41aadf02add2e326a1cfa320022e5db3600f9d4 (diff)
Fix CSS selector for removing elements (#7037)
fix https://github.com/FreshRSS/FreshRSS/issues/7014 Case of negative filter matching the positive filter
Diffstat (limited to 'app/Models/Entry.php')
-rw-r--r--app/Models/Entry.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index 747bebd71..6030451f2 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -842,8 +842,11 @@ HTML;
$path_entries_filter = trim($path_entries_filter, ', ');
foreach ($nodes as $node) {
if ($path_entries_filter !== '') {
- $filterednodes = $xpath->query((new Gt\CssXPath\Translator($path_entries_filter))->asXPath(), $node) ?: [];
+ $filterednodes = $xpath->query((new Gt\CssXPath\Translator($path_entries_filter, 'descendant-or-self::'))->asXPath(), $node) ?: [];
foreach ($filterednodes as $filterednode) {
+ if ($filterednode === $node) {
+ continue 2;
+ }
if (!($filterednode instanceof DOMElement) || $filterednode->parentNode === null) {
continue;
}