Skip to content

A free, self-hostable news aggregator…

Allow string in XPath tags (#5653)

Alexandre Alapetitedb53d2655b17
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 80d4e4580..e295804ae 100644
--- a/app/Models/Feed.php
+++ b/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) {