enhance: utils of safe path join

pull/6425/head
charlie 2022-08-17 18:23:01 +08:00 committed by Andelf
parent 005719cb06
commit 13091b8781
1 changed files with 2 additions and 1 deletions

View File

@ -317,7 +317,8 @@ export const nodePath = Object.assign({}, path, {
try { try {
orURI = new URL(input) orURI = new URL(input)
input = input.replace(orURI.protocol, '') input = input.replace(orURI.protocol + '//', '')
.replace(orURI.protocol, '')
.replace(/^\/+/, '/') .replace(/^\/+/, '/')
} catch (_e) {} } catch (_e) {}