Skip to content

Commit

Permalink
Fix handling of file:/// paths on *nix systems
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Jan 17, 2018
1 parent 3bd9b4b commit 958f95d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source-map-support.js
Expand Up @@ -66,7 +66,11 @@ retrieveFileHandlers.push(function(path) {
path = path.trim();
if (/^file:/.test(path)) {
// existsSync/readFileSync can't handle file protocol, but once stripped, it works
path = path.replace(/file:\/\/(\w:\\|\/)/, '');
path = path.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
return drive ?
'' : // file:///C:/dir/file -> C:/dir/file
'/'; // file:///root-dir/file -> /root-dir/file
});
}
if (path in fileContentsCache) {
return fileContentsCache[path];
Expand Down

0 comments on commit 958f95d

Please sign in to comment.