-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] iOS WKWebView caches old PDF blobs #4835
Comments
@maiconcarraro any ideas here? Or maybe @khmyznikov |
Repo: WKWebViewCache |
@jgw96 @ncpunt I found the root cause, inside of download function it returns the file by suggested name: so using the same name, will return the existing file, even if you have different blobs:
You can fix this by making sure to remove the previous file: func download(_ download: WKDownload, decideDestinationUsing response: URLResponse,
suggestedFilename: String,
completionHandler: @escaping (URL?) -> Void) {
let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fileURL = documentsPath.appendingPathComponent(suggestedFilename)
// Remove existing file if it exists
if FileManager.default.fileExists(atPath: fileURL.path) {
try? FileManager.default.removeItem(at: fileURL)
}
self.openFile(url: fileURL)
completionHandler(fileURL)
} see |
I did not realilze that "doc.output('bloburl')" would already generate a random filename. |
@ncpunt or @maiconcarraro would one of yall want to make a PR for this change? Our iOS platform is mainly community driven |
@jgw96 I sent on same day: pwa-builder/pwabuilder-ios#69 |
This issue has been marked as "needs attention 👋" since it has not been triaged for 7 days. Please triage the issue . |
4 similar comments
This issue has been marked as "needs attention 👋" since it has not been triaged for 7 days. Please triage the issue . |
This issue has been marked as "needs attention 👋" since it has not been triaged for 7 days. Please triage the issue . |
This issue has been marked as "needs attention 👋" since it has not been triaged for 7 days. Please triage the issue . |
This issue has been marked as "needs attention 👋" since it has not been triaged for 7 days. Please triage the issue . |
What happened?
If I use the following code to view a dynamically generated PDF on iOS-WKWebView using jsPDF, the same (first) PDF is shown regardless of any changes to later generated PDFs.
The only way to show fresh PDF contents is to randomize the filename.
Does anyone know an alternative method because I am a bit worried the cached files will pile up. I am also reluctant changing the Swift code generated by PWABuilder.
How do we reproduce the behavior?
Use the code in the description.
What do you expect to happen?
Behavior as in all other browsers where this is not required.
What environment were you using?
Physical iPhone 12 device (iOS 18) and a iOS Simulator on an Intel Mac
Additional context
All browsers and all platforms do not have this problem with the exception of iOS WKWebView.
The text was updated successfully, but these errors were encountered: