diff --git a/Modules/Images/Sources/Images/DownloadedImageCache.swift b/Modules/Images/Sources/Images/DownloadedImageCache.swift index 4b55a5be2..9409c9ab2 100644 --- a/Modules/Images/Sources/Images/DownloadedImageCache.swift +++ b/Modules/Images/Sources/Images/DownloadedImageCache.swift @@ -142,6 +142,11 @@ extension Notification.Name { downloadQueue.prioritize(key: url) } + /// True when the URL returned something other than an image, and the network status hasn’t changed since. + func returnedNonImage(_ url: String) -> Bool { + urlsThatReturnedNonImage.contains(url) + } + /// A copy made from the image at `url`, such as a scaled icon. Nil when none has been saved. func derivedImageData(for url: String, suffix: String) async -> Data? { await Self.readFromDisk(diskCache, key: Self.derivedDiskKey(url, suffix: suffix)) diff --git a/Modules/Images/Sources/Images/FeedIconDownloader.swift b/Modules/Images/Sources/Images/FeedIconDownloader.swift index 99bc82738..36b29fc98 100644 --- a/Modules/Images/Sources/Images/FeedIconDownloader.swift +++ b/Modules/Images/Sources/Images/FeedIconDownloader.swift @@ -257,7 +257,7 @@ private extension FeedIconDownloader { } let urlIsUnfetchable = !url.hasPrefix("http://") && !url.hasPrefix("https://") - if urlIsUnfetchable || ImageDatabase.shared.recentlyFailed(url: url) { + if urlIsUnfetchable || ImageDatabase.shared.recentlyFailed(url: url) || DownloadedImageCache.shared.returnedNonImage(url) { imageResultBlock(nil, true) return }