Merge branch 'fix-docx-file-handling'

This commit is contained in:
Marcos Zuriaga 2023-05-02 21:09:31 +02:00
commit 1cfb9bc8b6
No known key found for this signature in database
GPG key ID: 7D15585354D072FF

View file

@ -61,7 +61,7 @@
//go ahead and download dataURLs right away
if(/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(payload)){
if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)){
if(payload.length > (1024*1024*1.999) && myBlob !== toString ){
payload=dataUrlToBlob(payload);
@ -112,7 +112,7 @@
// handle non-a[download] safari as best we can:
if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
url=url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
url=url.replace(/^data:([\w\/\-\+\.]+)/, defaultMime);
if(!window.open(url)){ // popup blocked, offer direct download:
if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; }
}
@ -124,7 +124,7 @@
document.body.appendChild(f);
if(!winMode){ // force a mime that will download:
url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
url="data:"+url.replace(/^data:([\w\/\-\+\.]+)/, defaultMime);
}
f.src=url;
setTimeout(function(){ document.body.removeChild(f); }, 333);
@ -159,4 +159,4 @@
}
return true;
}; /* end download()*/
}));
}));