ソースを参照

Fix favicon error in case of wrong URL (#6899)

fix https://github.com/FreshRSS/FreshRSS/issues/6898
Alexandre Alapetite 1 年間 前
コミット
1a9d24d0dd
1 ファイル変更4 行追加3 行削除
  1. 4 3
      lib/favicons.php

+ 4 - 3
lib/favicons.php

@@ -25,10 +25,11 @@ function isImgMime(string $content): bool {
 /** @param array<int,int|bool> $curlOptions */
 function downloadHttp(string &$url, array $curlOptions = []): string {
 	syslog(LOG_INFO, 'FreshRSS Favicon GET ' . $url);
-	$url = checkUrl($url);
-	if ($url == false) {
+	$url2 = checkUrl($url);
+	if ($url2 == false) {
 		return '';
 	}
+	$url = $url2;
 	/** @var CurlHandle $ch */
 	$ch = curl_init($url);
 	curl_setopt_array($ch, [
@@ -56,7 +57,7 @@ function downloadHttp(string &$url, array $curlOptions = []): string {
 	curl_close($ch);
 	if (!empty($info['url'])) {
 		$url2 = checkUrl($info['url']);
-		if ($url2 != '') {
+		if ($url2 != false) {
 			$url = $url2;	//Possible redirect
 		}
 	}