From 8425e9033b1e1280a1738819ae6098d7d0d4ba7c Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 25 Nov 2017 13:46:48 -0800 Subject: [PATCH] =?UTF-8?q?Fix=20bug=20getting=20Dr.=20Drang=E2=80=99s=20f?= =?UTF-8?q?avicon.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Evergreen/Favicons/FaviconURLFinder.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Evergreen/Favicons/FaviconURLFinder.swift b/Evergreen/Favicons/FaviconURLFinder.swift index 5f9b30bcd..07cae4c8a 100644 --- a/Evergreen/Favicons/FaviconURLFinder.swift +++ b/Evergreen/Favicons/FaviconURLFinder.swift @@ -28,7 +28,15 @@ struct FaviconURLFinder { return } - let link = faviconURL(homePageURL, data) + // Use the absoluteString of the response’s URL instead of the homePageURL, + // since the homePageURL might actually have been redirected. + // Example: Dr. Drang’s feed reports the homePageURL as http://www.leancrew.com/all-this — + // but it gets redirected to http://www.leancrew.com/all-this/ — which is correct. + // This way any relative link to a favicon in the page’s metadata + // will be made absolute correctly. + + let urlToUse = response.url?.absoluteString ?? homePageURL + let link = faviconURL(urlToUse, data) callback(link) } }