Skip to content

Commit

Permalink
fix: prevent blob to show old file if they share same name
Browse files Browse the repository at this point in the history
  • Loading branch information
maiconcarraro authored Oct 27, 2024
1 parent d9f5270 commit 0e6101c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,12 @@ extension ViewController: WKUIDelegate, WKDownloadDelegate {
let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fileURL = documentsPath.appendingPathComponent(suggestedFilename)

// Remove existing file if it exists, otherwise it may show an old file/content just by having the same name.
if FileManager.default.fileExists(atPath: fileURL.path) {
try? FileManager.default.removeItem(at: fileURL)
}

self.openFile(url: fileURL)
completionHandler(fileURL)
}
}
}

0 comments on commit 0e6101c

Please sign in to comment.