From f861d5c0d4c5b6ba44c9775a8aa17d4bf0c91e36 Mon Sep 17 00:00:00 2001 From: alephneo <41024023+alephneo@users.noreply.github.com> Date: Sun, 7 Jul 2019 00:44:28 +0530 Subject: [PATCH] Fixed test/webserver to handle paths correctly on Windows --- test/webserver.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/webserver.js b/test/webserver.js index d8cd3055b..2d84d37ad 100644 --- a/test/webserver.js +++ b/test/webserver.js @@ -85,6 +85,10 @@ WebServer.prototype = { // `/../../../../../../../etc/passwd`, which let you make GET requests // for files outside of `this.root`. var pathPart = path.normalize(decodeURI(urlParts[1])); + // path.normalize returns a path on the basis of the current platform. + // Windows paths cause issues in statFile and serverDirectoryIndex. + // Converting to unix path would avoid platform checks in said functions. + pathPart = pathPart.replace(/\\/g, '/'); } catch (ex) { // If the URI cannot be decoded, a `URIError` is thrown. This happens for // malformed URIs such as `http://localhost:8888/%s%s` and should be