Skip to content

Commit 84fd468

Browse files
author
Ruben Nine
committed
Check that file exists before trying to remove it.
1 parent c47f27b commit 84fd468

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/FilestackSDK/Public/Models/FileLink.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,12 @@ public extension FileLink {
182182

183183
if let url = url {
184184
do {
185-
try FileManager.default.removeItem(at: destinationURL)
185+
if FileManager.default.fileExists(atPath: destinationURL.absoluteString) {
186+
try FileManager.default.removeItem(at: destinationURL)
187+
}
188+
186189
try FileManager.default.moveItem(at: url, to: destinationURL)
190+
187191
destURL = destinationURL
188192
} catch {
189193
err = error

0 commit comments

Comments
 (0)