Skip to content

Commit

Permalink
Fix mozilla#8907: Decode URL to get correct path in node_stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
mukulmishra18 committed Sep 19, 2017
1 parent e4295b9 commit 4de50e9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/display/node_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,9 @@ class PDFNodeStreamRangeReader extends BaseRangeReader {
class PDFNodeStreamFsFullReader extends BaseFullReader {
constructor(stream) {
super(stream);
let path = decodeURI(this._url.path);

fs.lstat(this._url.path, (error, stat) => {
fs.lstat(path, (error, stat) => {
if (error) {
this._errored = true;
this._reason = error;
Expand All @@ -371,7 +372,7 @@ class PDFNodeStreamFsFullReader extends BaseFullReader {
// Setting right content length.
this._contentLength = stat.size;

this._setReadableStream(fs.createReadStream(this._url.path));
this._setReadableStream(fs.createReadStream(path));
this._headersCapability.resolve();
});
}
Expand All @@ -382,7 +383,7 @@ class PDFNodeStreamFsRangeReader extends BaseRangeReader {
super(stream);

this._setReadableStream(
fs.createReadStream(this._url.path, { start, end: end - 1, }));
fs.createReadStream(decodeURI(this._url.path), { start, end: end - 1, }));
}
}

Expand Down

0 comments on commit 4de50e9

Please sign in to comment.