Ver código fonte

Allow string in XPath tags (#5653)

fix https://github.com/FreshRSS/FreshRSS/issues/5651
Alexandre Alapetite 2 anos atrás
pai
commit
db53d2655b
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      app/Models/Feed.php

+ 4 - 2
app/Models/Feed.php

@@ -723,8 +723,10 @@ class FreshRSS_Feed extends Minz_Model {
 				}
 				$item['thumbnail'] = $xPathItemThumbnail == '' ? '' : @$xpath->evaluate('normalize-space(' . $xPathItemThumbnail . ')', $node);
 				if ($xPathItemCategories != '') {
-					$itemCategories = @$xpath->query($xPathItemCategories, $node);
-					if ($itemCategories !== false) {
+					$itemCategories = @$xpath->evaluate($xPathItemCategories, $node);
+					if (is_string($itemCategories) && $itemCategories !== '') {
+						$item['tags'] = [$itemCategories];
+					} elseif ($itemCategories instanceof DOMNodeList && $itemCategories->length > 0) {
 						$item['tags'] = [];
 						/** @var DOMNode $itemCategory */
 						foreach ($itemCategories as $itemCategory) {