Skip to content

Commit

Permalink
fix: remove double slashes from UNC paths
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Sep 7, 2016
1 parent dea22a3 commit a1204c0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ module.exports = function normalize(path) {
path = path.replace(parentDirectoryNixEndRegExp2, "");
path = path.replace(parentDirectoryNixEndRegExp3, "/");

if (doubleSlackUNCRegExp.test(path)) {
return path;
var unc = doubleSlackUNCRegExp.test(path);

path = path.replace(doubleSlashWinRegExp, "\\").replace(doubleSlashNixRegExp, "/")

if (unc) {
path = '\\' + path;
}

return path.replace(doubleSlashWinRegExp, "\\").replace(doubleSlashNixRegExp, "/");
};
return path;
};

0 comments on commit a1204c0

Please sign in to comment.