|
|
@@ -29,6 +29,7 @@ this.singlefile.lib.util = this.singlefile.lib.util || (() => {
|
|
|
const ONE_MB = 1024 * 1024;
|
|
|
const PREFIX_CONTENT_TYPE_TEXT = "text/";
|
|
|
const DEFAULT_REPLACED_CHARACTERS = ["~", "+", "\\\\", "?", "%", "*", ":", "|", "\"", "<", ">", "\x00-\x1f", "\x7F"];
|
|
|
+ const DEFAULT_REPLACEMENT_CHARACTER = "_";
|
|
|
|
|
|
const URL = window.URL;
|
|
|
const DOMParser = window.DOMParser;
|
|
|
@@ -83,7 +84,7 @@ this.singlefile.lib.util = this.singlefile.lib.util || (() => {
|
|
|
resolveURL(resourceURL, baseURI) {
|
|
|
return this.parseURL(resourceURL, baseURI).href;
|
|
|
},
|
|
|
- getValidFilename(filename, replacedCharacters = DEFAULT_REPLACED_CHARACTERS, replacementCharacter) {
|
|
|
+ getValidFilename(filename, replacedCharacters = DEFAULT_REPLACED_CHARACTERS, replacementCharacter = DEFAULT_REPLACEMENT_CHARACTER) {
|
|
|
replacedCharacters.forEach(replacedCharacter => filename = filename.replace(new RegExp("[" + replacedCharacter + "]+", "g"), replacementCharacter));
|
|
|
filename = filename
|
|
|
.replace(/\.\.\//g, "")
|