From dc1f3ce86e7607ce43ca6b7ec948a040dee2d762 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 31 Oct 2026 14:37:44 -0700 Subject: [PATCH] =?UTF-8?q?Skip=20saving=20a=20scaled=20icon=20when=20it?= =?UTF-8?q?=E2=80=99s=20identical=20to=20the=20original,=20so=20small=20ic?= =?UTF-8?q?ons=20and=20SVGs=20aren=E2=80=99t=20stored=20twice.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Images/Sources/Images/ImageDownloader.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/Images/Sources/Images/ImageDownloader.swift b/Modules/Images/Sources/Images/ImageDownloader.swift index 7840b1dcc..bd5c7b268 100644 --- a/Modules/Images/Sources/Images/ImageDownloader.swift +++ b/Modules/Images/Sources/Images/ImageDownloader.swift @@ -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 {