From 9eba8726ac08d75730a9ed5fd26047f502007dfd Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 14 Nov 2023 12:58:57 +0100 Subject: API fix add feed with title (#5868) fix https://github.com/FreshRSS/FreshRSS/issues/5866 --- app/Models/Feed.php | 17 +++++++++++------ p/api/greader.php | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/Models/Feed.php b/app/Models/Feed.php index ed1468744..38c6ca37e 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -400,12 +400,17 @@ class FreshRSS_Feed extends Minz_Model { // si on a utilisé l’auto-discover, notre url va avoir changé $subscribe_url = $simplePie->subscribe_url(false); - //HTML to HTML-PRE //ENT_COMPAT except '&' - $title = strtr(html_only_entity_decode($simplePie->get_title()), ['<' => '<', '>' => '>', '"' => '"']); - $this->_name($title == '' ? $this->url : $title); - - $this->_website(html_only_entity_decode($simplePie->get_link())); - $this->_description(html_only_entity_decode($simplePie->get_description())); + if ($this->name(true) === '') { + //HTML to HTML-PRE //ENT_COMPAT except '&' + $title = strtr(html_only_entity_decode($simplePie->get_title()), ['<' => '<', '>' => '>', '"' => '"']); + $this->_name($title == '' ? $this->url : $title); + } + if ($this->website() === '') { + $this->_website(html_only_entity_decode($simplePie->get_link())); + } + if ($this->description() === '') { + $this->_description(html_only_entity_decode($simplePie->get_description())); + } } else { //The case of HTTP 301 Moved Permanently $subscribe_url = $simplePie->subscribe_url(true); diff --git a/p/api/greader.php b/p/api/greader.php index a93bad52e..77defb326 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -581,7 +581,7 @@ final class GReaderAPI { /** * @param 'A'|'c'|'f'|'s' $type * @param string|int $streamId - * @return array{'A'|'c'|'f'|'s'|'t',int,int,FreshRSS_BooleanSearch} + * @phpstan-return array{'A'|'c'|'f'|'s'|'t',int,int,FreshRSS_BooleanSearch} */ private static function streamContentsFilters(string $type, $streamId, string $filter_target, string $exclude_target, int $start_time, int $stop_time): array { -- cgit v1.2.3