Skip to content

Commit

Permalink
Merge branch 'nextcloud:master' into fix-scrolling-with-key-navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
wofferl authored Sep 29, 2024
2 parents 862e44c + 008c189 commit 8c16c6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ You can also check [on GitHub](https://github.com/nextcloud/news/releases), the


### Fixed
- Allow feed title to be null in DB. #2745
- Allow feed title to be null in DB. (#2745)
- Store HTTP last modified date from response header (#2724)

# Releases
## [25.0.0-alpha8] - 2024-07-07
Expand Down
18 changes: 10 additions & 8 deletions lib/Fetcher/FeedFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class FeedFetcher implements IFeedFetcher
* @var FetcherConfig
*/
private $fetcherConfig;

/**
* @var Cache
*/
Expand Down Expand Up @@ -145,6 +145,12 @@ public function fetch(
$location
);

if (!is_null($resource->getResponse()->getLastModified())) {
$feed->setHttpLastModified($resource->getResponse()->getLastModified()->format(DateTime::RSS));
} elseif (!is_null($lastModified)) {
$feed->setHttpLastModified($lastModified->format(DateTime::RSS));
}

$items = [];
$RTL = $this->determineRtl($parsedFeed);
$feedName = $parsedFeed->getTitle();
Expand Down Expand Up @@ -373,11 +379,11 @@ protected function getFavicon(FeedInterface $feed, string $url): ?string
$favicon = null;
// trim the string because authors do funny things
$feed_logo = $feed->getLogo();

if (!is_null($feed_logo)) {
$favicon = trim($feed_logo);
}

ini_set('user_agent', FetcherConfig::DEFAULT_USER_AGENT);

$base_url = new Net_URL2($url);
Expand Down Expand Up @@ -494,16 +500,12 @@ protected function buildFeed(FeedInterface $feed, string $url, string $location)
$title = strip_tags($this->decodeTwice($feed->getTitle()));
$newFeed->setTitle($title);
}

$newFeed->setUrl($url); // the url used to add the feed
$newFeed->setLocation($location); // the url where the feed was found
$newFeed->setLink($feed->getLink()); // <link> attribute in the feed
if ($feed->getLastModified() instanceof DateTime) {
$newFeed->setHttpLastModified($feed->getLastModified()->format(DateTime::RSS));
}
$newFeed->setAdded($this->time->getTime());



$favicon = $this->getFavicon($feed, $url);
$newFeed->setFaviconLink($favicon);

Expand Down

0 comments on commit 8c16c6e

Please sign in to comment.