Skip to content

Commit 120f059

Browse files
committed
Avoid normalising well-formed URIs by default
References: file-icons/atom-fs#1
1 parent 09b8eaf commit 120f059

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/node.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,17 @@ function load(url, encoding = "utf8"){
4545
/**
4646
* Normalise path separators.
4747
*
48+
* Well-formed URIs (those prefixed by `protocol://`)
49+
* are returned unmodified unless `clobber` is truthy.
50+
*
4851
* @example "C:\User\foo\..\bar" -> "C:/User/bar"
4952
* @param {String} input
53+
* @param {Boolean} [clobber=false]
5054
* @return {String}
5155
*/
52-
function normalisePath(input){
56+
function normalisePath(input, clobber = false){
57+
if(!clobber && /^\w*:\/\//.test(input))
58+
return input;
5359
input = resolve(input || "");
5460
return "win32" === process.platform
5561
? input.replace(/\\/g, "/")

0 commit comments

Comments
 (0)