mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Fixed test/webserver to handle paths correctly on Windows
This commit is contained in:
parent
2cc0bfd1b1
commit
f861d5c0d4
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue