Merge pull request #3862 from sveltejs/gh-3846-windows-fix

encode parts of filename, not entire string
pull/3876/head
Rich Harris 5 years ago committed by GitHub
commit deb5b681f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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+)/);

Loading…
Cancel
Save