mirror of
https://github.com/nextcloud/passman.git
synced 2025-11-09 21:51:36 +08:00
Merge branch 'fix-docx-file-handling'
This commit is contained in:
commit
1cfb9bc8b6
1 changed files with 4 additions and 4 deletions
8
js/vendor/download.js
vendored
8
js/vendor/download.js
vendored
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
|
|
||||||
//go ahead and download dataURLs right away
|
//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 ){
|
if(payload.length > (1024*1024*1.999) && myBlob !== toString ){
|
||||||
payload=dataUrlToBlob(payload);
|
payload=dataUrlToBlob(payload);
|
||||||
|
|
@ -112,7 +112,7 @@
|
||||||
|
|
||||||
// handle non-a[download] safari as best we can:
|
// handle non-a[download] safari as best we can:
|
||||||
if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
|
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(!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; }
|
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);
|
document.body.appendChild(f);
|
||||||
|
|
||||||
if(!winMode){ // force a mime that will download:
|
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;
|
f.src=url;
|
||||||
setTimeout(function(){ document.body.removeChild(f); }, 333);
|
setTimeout(function(){ document.body.removeChild(f); }, 333);
|
||||||
|
|
@ -159,4 +159,4 @@
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}; /* end download()*/
|
}; /* end download()*/
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue