From 82cc41a1e8c67e657a3beaa8176d375c2b621933 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 6 Nov 2019 13:25:45 -0500 Subject: [PATCH 1/2] encode parts of filename, not entire string --- src/compiler/compile/utils/get_name_from_filename.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/compile/utils/get_name_from_filename.ts b/src/compiler/compile/utils/get_name_from_filename.ts index 04479ce6bd..aa310c52bd 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 = encodeURI(filename).split(/[\/\\]/); + + const parts = filename.split(/[\/\\]/).map(encodeURI); if (parts.length > 1) { const index_match = parts[parts.length - 1].match(/^index(\.\w+)/); From 07e85c26f031b7ba04ecf73527dc4cd14c02ca1e Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 6 Nov 2019 13:27:09 -0500 Subject: [PATCH 2/2] lint --- src/compiler/compile/utils/get_name_from_filename.ts | 2 +- 1 file changed, 1 insertion(+), 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 aa310c52bd..d1e0e167ce 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; - const parts = filename.split(/[\/\\]/).map(encodeURI); + const parts = filename.split(/[/\\]/).map(encodeURI); if (parts.length > 1) { const index_match = parts[parts.length - 1].match(/^index(\.\w+)/);