aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rwxr-xr-xapp/Controllers/feedController.php10
-rw-r--r--app/Controllers/subscriptionController.php1
-rw-r--r--app/Models/Feed.php10
3 files changed, 14 insertions, 7 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index a080d5e67..4cd5e7369 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -722,11 +722,13 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$feed->_name($name);
$feedProperties['name'] = $feed->name(false);
}
- if (trim($feed->website()) === '') {
+ if ($feed->website() === '' || $feed->website() === $feed->url()) {
$website = html_only_entity_decode($simplePie->get_link());
- $feed->_website($website == '' ? $feed->url() : $website);
- $feedProperties['website'] = $feed->website();
- $feed->faviconPrepare();
+ if ($website !== $feed->website()) {
+ $feed->_website($website);
+ $feedProperties['website'] = $feed->website();
+ $feed->faviconPrepare();
+ }
}
if (trim($feed->description()) === '') {
$description = html_only_entity_decode($simplePie->get_description());
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index 58cda4b9b..70065fc26 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -369,7 +369,6 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
}
if ($favicon_uploaded && !$resetFavicon) {
- require_once(LIB_PATH . '/favicons.php');
$max_size = FreshRSS_Context::systemConf()->limits['max_favicon_upload_size'];
if ($favicon_size > $max_size) {
Minz_Request::bad(_t('feedback.sub.feed.favicon.too_large', format_bytes($max_size)), $url_redirect);
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 81765d433..2b442561e 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -176,6 +176,8 @@ class FreshRSS_Feed extends Minz_Model {
}
$attributesOnly = $contents === null && $tmpPath === '';
+
+ require_once(LIB_PATH . '/favicons.php');
if (!$attributesOnly && !isImgMime(is_string($contents) ? $contents : '')) {
throw new FreshRSS_UnsupportedImageFormat_Exception();
}
@@ -195,7 +197,6 @@ class FreshRSS_Feed extends Minz_Model {
$this->_attribute('customFaviconExt', $extName);
$this->_attribute('customFaviconDisallowDel', $disallowDelete);
- require_once(LIB_PATH . '/favicons.php');
$newPath = FAVICONS_DIR . $this->hashFavicon(skipCache: true) . '.ico';
if ($attributesOnly && !file_exists($newPath)) {
$updateFeed = false;
@@ -404,7 +405,12 @@ class FreshRSS_Feed extends Minz_Model {
if ($this->customFavicon()) {
return;
}
- $url = $this->website(fallback: true);
+ $url = $this->website(fallback: false);
+ if ($url === '' || $url === $this->url) {
+ // Get root URL from the feed URL
+ $url = preg_replace('%^(https?://[^/]+).*$%i', '$1/', $this->url) ?? $this->url;
+ }
+
$txt = FAVICONS_DIR . $this->hashFavicon() . '.txt';
if (@file_get_contents($txt) !== $url) {
file_put_contents($txt, $url);