mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Skip saving a scaled icon when it’s identical to the original, so small icons and SVGs aren’t stored twice.
This commit is contained in:
1 parent
158bcec9dd
commit
dc1f3ce86e
1 file changed
+4
-1
@@ -141,7 +141,10 @@ private extension ImageDownloader {
|
||||
do {
|
||||
let storedData = try await DownloadedImageCache.shared.imageData(for: url, downloadPriority: nil, checksForUpdates: true, activityOwner: activityOwner, activityKind: activityKind, activityDetail: activityDetail)
|
||||
let data = await Self.scaledImageData(storedData, maxPixelSize: RSImage.maxIconPixelSize)
|
||||
await DownloadedImageCache.shared.saveDerivedImageData(data, for: url, suffix: Self.scaledCopySuffix)
|
||||
// An image that’s already small enough needs no second file.
|
||||
if data != storedData {
|
||||
await DownloadedImageCache.shared.saveDerivedImageData(data, for: url, suffix: Self.scaledCopySuffix)
|
||||
}
|
||||
cacheImage(url, data)
|
||||
} catch {
|
||||
if !error.isTransient {
|
||||
|
||||
Reference in new issue
Block a user