Skip to content

Commit e349604

Browse files
Merge pull request mozilla#10950 from monchouchou/master
Fixed testing webserver to handle paths correctly on Windows
2 parents ed3954f + f861d5c commit e349604

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/webserver.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ WebServer.prototype = {
8585
// `/../../../../../../../etc/passwd`, which let you make GET requests
8686
// for files outside of `this.root`.
8787
var pathPart = path.normalize(decodeURI(urlParts[1]));
88+
// path.normalize returns a path on the basis of the current platform.
89+
// Windows paths cause issues in statFile and serverDirectoryIndex.
90+
// Converting to unix path would avoid platform checks in said functions.
91+
pathPart = pathPart.replace(/\\/g, '/');
8892
} catch (ex) {
8993
// If the URI cannot be decoded, a `URIError` is thrown. This happens for
9094
// malformed URIs such as `http://localhost:8888/%s%s` and should be

0 commit comments

Comments
 (0)