From f9374f93f5ade6ffc849c3bfd2d2bc35b2ca67f4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 09:36:25 -0500 Subject: [PATCH] [7820] Attempt to fix potential issue with tab screenshots not being cleaned up properly. Needs some additional investigation. (#17438) (#17442) (cherry picked from commit 385859fc0df52cdb88550de235c75facc7b4e27a) Co-authored-by: mattreaganmozilla <145381717+mattreaganmozilla@users.noreply.github.com> --- Storage/DiskImageStore.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Storage/DiskImageStore.swift b/Storage/DiskImageStore.swift index 91295a488d34..812f83083e68 100644 --- a/Storage/DiskImageStore.swift +++ b/Storage/DiskImageStore.swift @@ -86,13 +86,13 @@ public actor DefaultDiskImageStore: DiskImageStore { } public func clearAllScreenshotsExcluding(_ keys: Set) async throws { - let keysToDelete = keys.subtracting(keys) + let keysToDelete = self.keys.subtracting(keys) for key in keysToDelete { let url = URL(fileURLWithPath: filesDir).appendingPathComponent(key) try FileManager.default.removeItem(at: url) } - self.keys = keys.intersection(keys) + self.keys = keys } public func deleteImageForKey(_ key: String) async {