Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/FileSaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ var _global = typeof window === 'object' && window.window === window
? global
: this

function stripNameOfInvalidChars(name) {
var isEdge17_17134 = /Edge\/17.17134/.test(navigator.userAgent)
if(isEdge17_17134){
var forbiddenChars = ['<', '>', ':', '"', '/', '\\', '|', '?', '*'];
for(var i = 0;i < forbiddenChars.length; i++) {
name = name.replace(forbiddenChars[i], '_');
}
}
return name;
}

function bom (blob, opts) {
if (typeof opts === 'undefined') opts = { autoBom: false }
else if (typeof opts !== 'object') {
Expand Down Expand Up @@ -83,6 +94,7 @@ var saveAs = _global.saveAs || (
// Namespace is used to prevent conflict w/ Chrome Poper Blocker extension (Issue #561)
var a = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')
name = name || blob.name || 'download'
name = stripNameOfInvalidChars(name);

a.download = name
a.rel = 'noopener' // tabnabbing
Expand Down