commit 49c4efb9d422819f17273701bd3d0d2a28815e2f parent 46f3d8cdddf772e4065b5667d399f537c70bdf58 Author: finwo <finwo@pm.me> Date: Sat, 24 Jul 2021 03:19:06 +0200 Fixed inconsistent directory detection Diffstat:
| M | src/to-absolute-path.js | | | 6 | +++--- |
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/to-absolute-path.js b/src/to-absolute-path.js @@ -5,9 +5,9 @@ module.exports = function toAbsolutePath( parsedLocation ) { if ( 'string' === typeof parsedLocation ) { parsedLocation = require('url-parse')(parsedLocation); } - let targetLocation = parsedLocation.hostname + parsedLocation.pathname; - if ( targetLocation.substr(0,1) !== '/' ) { - targetLocation = basedir + '/' + targetLocation; + let targetLocation = '/' + parsedLocation.hostname + parsedLocation.pathname; + if (!( parsedLocation.protocol && parsedLocation.hostname )) { + targetLocation = basedir + targetLocation; } return targetLocation.replace(/\//g,path.sep); };