Skip to content

Commit

Permalink
Merge pull request #8 from mrcarlberg/mjwwit_unescape_url_pathname_wh…
Browse files Browse the repository at this point in the history
…en_loading_from_local_filesystem

Unescape pathname from url when loading from local filesystem
  • Loading branch information
mjwwit committed May 4, 2021
2 parents ee1e81f + 6a0a91d commit 4e8322f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/XMLHttpRequest.js
Expand Up @@ -322,7 +322,7 @@ function XMLHttpRequest(opts) {
}

if (settings.async) {
fs.readFile(url.pathname, 'utf8', function(error, data) {
fs.readFile(unescape(url.pathname), 'utf8', function(error, data) {
if (error) {
self.handleError(error);
} else {
Expand All @@ -333,7 +333,7 @@ function XMLHttpRequest(opts) {
});
} else {
try {
this.responseText = fs.readFileSync(url.pathname, 'utf8');
this.responseText = fs.readFileSync(unescape(url.pathname), 'utf8');
this.status = 200;
setState(self.DONE);
} catch(e) {
Expand Down

0 comments on commit 4e8322f

Please sign in to comment.