summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2021-04-30 12:58:17 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2021-05-02 11:42:28 +0200
commit6f5c689fade5b58a01a3ef47a721e695b6d5893b (patch)
tree68dc94190043c13ca8ed1f01c310a751f20d10e2
parent1f94371c5aa4c4a2ce171524689f1a2c9b139948 (diff)
check if file was actually downloaded
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rwxr-xr-xlib/Fetcher/FeedFetcher.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php
index 365b86848..f1c6fdb90 100755
--- a/lib/Fetcher/FeedFetcher.php
+++ b/lib/Fetcher/FeedFetcher.php
@@ -335,25 +335,23 @@ class FeedFetcher implements IFeedFetcher
}
$favicon_path = join("/", [$this->ITempManager->getTempBaseDir(), basename($favicon)]);
- copy(
+
+ $downloaded = copy(
$favicon,
$favicon_path
);
- $is_image = substr(mime_content_type($favicon_path), 0, 5) === "image";
-
- $base_url = new Net_URL2($url);
- $base_url->setPath('');
+ $is_image = $downloaded && substr(mime_content_type($favicon_path), 0, 5) === "image";
// check if file is actually an image
if (!$is_image) {
- return $this->faviconFactory->get($base_url->getNormalizedURL());
+ return $this->faviconFactory->get($url);
}
list($width, $height, $type, $attr) = getimagesize($favicon_path);
// check if image is square else fall back to favicon
if ($width !== $height) {
- return $this->faviconFactory->get($base_url);
+ return $this->faviconFactory->get($url);
}
return $favicon;