Skip to content

Commit

Permalink
Merge pull request #202 from kriszyp/file-protocol-support2
Browse files Browse the repository at this point in the history
Fix handling of file:/// paths on *nix systems
  • Loading branch information
LinusU committed Jan 19, 2018
2 parents 88008a6 + 958f95d commit 7aaf30b
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 7aaf30b

Please sign in to comment.