diff --git a/lib/node.js b/lib/node.js index 37b361e..18e99e3 100644 --- a/lib/node.js +++ b/lib/node.js @@ -45,11 +45,17 @@ function load(url, encoding = "utf8"){ /** * Normalise path separators. * + * Well-formed URIs (those prefixed by `protocol://`) + * are returned unmodified unless `clobber` is truthy. + * * @example "C:\User\foo\..\bar" -> "C:/User/bar" * @param {String} input + * @param {Boolean} [clobber=false] * @return {String} */ -function normalisePath(input){ +function normalisePath(input, clobber = false){ + if(!clobber && /^\w*:\/\//.test(input)) + return input; input = resolve(input || ""); return "win32" === process.platform ? input.replace(/\\/g, "/")