From 36bfdf9dcbb3c3c68917f54daa8647917ea40fa7 Mon Sep 17 00:00:00 2001 From: fmodf Date: Sat, 13 Jul 2024 17:02:57 +0200 Subject: [PATCH] wip --- ConversationsClassic/AppCore/Files/DownloadManager.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ConversationsClassic/AppCore/Files/DownloadManager.swift b/ConversationsClassic/AppCore/Files/DownloadManager.swift index 83e5d39..f19d956 100644 --- a/ConversationsClassic/AppCore/Files/DownloadManager.swift +++ b/ConversationsClassic/AppCore/Files/DownloadManager.swift @@ -27,6 +27,9 @@ final class DownloadManager { if let tempLocalUrl = tempLocalUrl, error == nil { do { + if FileManager.default.fileExists(atPath: localUrl.path) { + try FileManager.default.removeItem(at: localUrl) + } try FileManager.default.copyItem(at: tempLocalUrl, to: localUrl) completion(nil) } catch let writeError {