pr-fix-cleanFileName by cyfung1031 · Pull Request #1203 · scriptscat/scriptcat
Expand Up
@@ -396,8 +396,14 @@ export function toCamelCase(key: SystemConfigKey) {
}
export function cleanFileName(name: string): string { // eslint-disable-next-line no-control-regex, no-useless-escape return name.replace(/[\x00-\x1F\\\/:*?"<>|]+/g, "-").trim(); // https://github.com/Tampermonkey/tampermonkey/issues/2413 // https://developer.chrome.com/docs/extensions/reference/api/downloads#type-DownloadOptions // A file path relative to the Downloads directory to contain the downloaded file, possibly containing subdirectories. // Absolute paths, empty paths, and paths containing back-references ".." will cause an error. let n = name; // eslint-disable-next-line no-control-regex n = n.replace(/[\x00-\x1F\\:*?"<>|]+/g, "-"); return n.replace(/\.\.+/g, "-").trim(); }
export const sourceMapTo = (scriptName: string) => { Expand Down
export function cleanFileName(name: string): string { // eslint-disable-next-line no-control-regex, no-useless-escape return name.replace(/[\x00-\x1F\\\/:*?"<>|]+/g, "-").trim(); // https://github.com/Tampermonkey/tampermonkey/issues/2413 // https://developer.chrome.com/docs/extensions/reference/api/downloads#type-DownloadOptions // A file path relative to the Downloads directory to contain the downloaded file, possibly containing subdirectories. // Absolute paths, empty paths, and paths containing back-references ".." will cause an error. let n = name; // eslint-disable-next-line no-control-regex n = n.replace(/[\x00-\x1F\\:*?"<>|]+/g, "-"); return n.replace(/\.\.+/g, "-").trim(); }
export const sourceMapTo = (scriptName: string) => { Expand Down