Skip to content

Commit b7fa46d

Browse files
authored
Merge pull request #69 from maiconcarraro/main
fix: prevent blob to show old file if they share same name
2 parents 8115cf3 + 0e6101c commit b7fa46d

File tree

1 file changed

+6
-1
lines changed
  • Microsoft.PWABuilder.IOS.Web/Resources/ios-project-src/pwa-shell

1 file changed

+6
-1
lines changed

Microsoft.PWABuilder.IOS.Web/Resources/ios-project-src/pwa-shell/WebView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,12 @@ extension ViewController: WKUIDelegate, WKDownloadDelegate {
365365
let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
366366
let fileURL = documentsPath.appendingPathComponent(suggestedFilename)
367367

368+
// Remove existing file if it exists, otherwise it may show an old file/content just by having the same name.
369+
if FileManager.default.fileExists(atPath: fileURL.path) {
370+
try? FileManager.default.removeItem(at: fileURL)
371+
}
372+
368373
self.openFile(url: fileURL)
369374
completionHandler(fileURL)
370375
}
371-
}
376+
}

0 commit comments

Comments
 (0)