Skip to content

Commit 1cfb9bc

Browse files
committed
Merge branch 'fix-docx-file-handling'
2 parents 9da9455 + c28afd1 commit 1cfb9bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

js/vendor/download.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262

6363
//go ahead and download dataURLs right away
64-
if(/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(payload)){
64+
if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)){
6565

6666
if(payload.length > (1024*1024*1.999) && myBlob !== toString ){
6767
payload=dataUrlToBlob(payload);
@@ -112,7 +112,7 @@
112112

113113
// handle non-a[download] safari as best we can:
114114
if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
115-
url=url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
115+
url=url.replace(/^data:([\w\/\-\+\.]+)/, defaultMime);
116116
if(!window.open(url)){ // popup blocked, offer direct download:
117117
if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; }
118118
}
@@ -124,7 +124,7 @@
124124
document.body.appendChild(f);
125125

126126
if(!winMode){ // force a mime that will download:
127-
url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
127+
url="data:"+url.replace(/^data:([\w\/\-\+\.]+)/, defaultMime);
128128
}
129129
f.src=url;
130130
setTimeout(function(){ document.body.removeChild(f); }, 333);
@@ -159,4 +159,4 @@
159159
}
160160
return true;
161161
}; /* end download()*/
162-
}));
162+
}));

0 commit comments

Comments
 (0)