Remove normalizedHomePageURL now that it’s part of standard URL normalizing.
This commit is contained in:
parent
1c9d970efd
commit
0a08faf02a
|
@ -70,7 +70,7 @@ final class FaviconDownloader {
|
||||||
|
|
||||||
func favicon(withHomePageURL homePageURL: String) -> NSImage? {
|
func favicon(withHomePageURL homePageURL: String) -> NSImage? {
|
||||||
|
|
||||||
let url = normalizedHomePageURL(homePageURL)
|
let url = homePageURL.rs_normalizedURL()
|
||||||
if homePageURLsWithNoFaviconURL.contains(url) {
|
if homePageURLsWithNoFaviconURL.contains(url) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -135,24 +135,6 @@ private extension FaviconDownloader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizedHomePageURL(_ url: String) -> String {
|
|
||||||
|
|
||||||
// Many times the homePageURL is missing a trailing /.
|
|
||||||
// We add one when needed.
|
|
||||||
|
|
||||||
guard !url.hasSuffix("/") else {
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
let lowercasedURL = url.lowercased(with: FaviconDownloader.localeForLowercasing)
|
|
||||||
guard lowercasedURL.hasPrefix("http://") || lowercasedURL.hasPrefix("https://") else {
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
guard url.components(separatedBy: "/").count < 4 else {
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
return url + "/"
|
|
||||||
}
|
|
||||||
|
|
||||||
func faviconDownloader(withURL faviconURL: String) -> SingleFaviconDownloader {
|
func faviconDownloader(withURL faviconURL: String) -> SingleFaviconDownloader {
|
||||||
|
|
||||||
if let downloader = singleFaviconDownloaderCache[faviconURL] {
|
if let downloader = singleFaviconDownloaderCache[faviconURL] {
|
||||||
|
|
Loading…
Reference in New Issue