-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
.txt extension added on downloaded files on iphone #785
Comments
hmm, maybe change the type to something like |
@collax I'm having this exact issue. Have you found a fix? |
if anyone is reading this, i figured out a workaround to download the PDF file without the .txt extension from a Blob. (only checked that this works for PDF specifically) export const saveFile = async (blob: Blob, suggestedName: string) => {
const isPdf = suggestedName.includes("pdf");
if (!isPdf) {
FileSaver.saveAs(blob, suggestedName);
return;
}
const pdfBlob = new Blob([blob], { type: "application/pdf" });
const blobUrl = window.URL.createObjectURL(pdfBlob);
const link = document.createElement("a");
link.href = blobUrl;
link.setAttribute("download", `${suggestedName}`);
document.body.appendChild(link);
link.click();
link.parentNode?.removeChild(link);
window.URL.revokeObjectURL(blobUrl);
}; |
Hi,
I have a problem that happen only on Iphone, the .txt extension is added at the end of the file when downloaded.
It seem to work fine on other devices (even on safari on mac)
Simple sample code that I use:
For example on Iphone, this will give the file a "workout.zwo.txt" name instead of a "workout.zwo"
Is there a way to fix this ?
Thanks
The text was updated successfully, but these errors were encountered: