Selaa lähdekoodia

added default replaced chars

Former-commit-id: ed02623d6d164ad276358da0460783977a1945d0
Gildas 6 vuotta sitten
vanhempi
sitoutus
abfa118b7c
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      lib/single-file/single-file-util.js

+ 2 - 1
lib/single-file/single-file-util.js

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