Skip to content

Commit 4e8322f

Browse files
authored
Merge pull request #8 from mrcarlberg/mjwwit_unescape_url_pathname_when_loading_from_local_filesystem
Unescape pathname from url when loading from local filesystem
2 parents ee1e81f + 6a0a91d commit 4e8322f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/XMLHttpRequest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ function XMLHttpRequest(opts) {
322322
}
323323

324324
if (settings.async) {
325-
fs.readFile(url.pathname, 'utf8', function(error, data) {
325+
fs.readFile(unescape(url.pathname), 'utf8', function(error, data) {
326326
if (error) {
327327
self.handleError(error);
328328
} else {
@@ -333,7 +333,7 @@ function XMLHttpRequest(opts) {
333333
});
334334
} else {
335335
try {
336-
this.responseText = fs.readFileSync(url.pathname, 'utf8');
336+
this.responseText = fs.readFileSync(unescape(url.pathname), 'utf8');
337337
this.status = 200;
338338
setState(self.DONE);
339339
} catch(e) {

0 commit comments

Comments
 (0)