From 1cd893ad970d8d939946ef42af4dd65b33a6de04 Mon Sep 17 00:00:00 2001 From: "Fernando G. Vilar" Date: Sun, 3 Nov 2019 16:43:22 +0700 Subject: [PATCH] feat: support unicode filenames --- src/compiler/compile/utils/get_name_from_filename.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/compile/utils/get_name_from_filename.ts b/src/compiler/compile/utils/get_name_from_filename.ts index 19c781825c..04479ce6bd 100644 --- a/src/compiler/compile/utils/get_name_from_filename.ts +++ b/src/compiler/compile/utils/get_name_from_filename.ts @@ -1,7 +1,7 @@ export default function get_name_from_filename(filename: string) { if (!filename) return null; // eslint-disable-next-line no-useless-escape - const parts = filename.split(/[\/\\]/); + const parts = encodeURI(filename).split(/[\/\\]/); if (parts.length > 1) { const index_match = parts[parts.length - 1].match(/^index(\.\w+)/); @@ -12,6 +12,7 @@ export default function get_name_from_filename(filename: string) { } const base = parts.pop() + .replace(/%/g, 'u') .replace(/\.[^.]+$/, "") .replace(/[^a-zA-Z_$0-9]+/g, '_') .replace(/^_/, '')