Fix #8907: Decode URL to get correct path in node_stream.

This commit is contained in:
Mukul Mishra 2017-09-19 15:10:36 +05:30
parent 9c2e9dae26
commit e4c09c7cba

View File

@ -360,8 +360,9 @@ class PDFNodeStreamRangeReader extends BaseRangeReader {
class PDFNodeStreamFsFullReader extends BaseFullReader { class PDFNodeStreamFsFullReader extends BaseFullReader {
constructor(stream) { constructor(stream) {
super(stream); super(stream);
let path = decodeURI(this._url.path);
fs.lstat(this._url.path, (error, stat) => { fs.lstat(path, (error, stat) => {
if (error) { if (error) {
this._errored = true; this._errored = true;
this._reason = error; this._reason = error;
@ -371,7 +372,7 @@ class PDFNodeStreamFsFullReader extends BaseFullReader {
// Setting right content length. // Setting right content length.
this._contentLength = stat.size; this._contentLength = stat.size;
this._setReadableStream(fs.createReadStream(this._url.path)); this._setReadableStream(fs.createReadStream(path));
this._headersCapability.resolve(); this._headersCapability.resolve();
}); });
} }
@ -382,7 +383,7 @@ class PDFNodeStreamFsRangeReader extends BaseRangeReader {
super(stream); super(stream);
this._setReadableStream( this._setReadableStream(
fs.createReadStream(this._url.path, { start, end: end - 1, })); fs.createReadStream(decodeURI(this._url.path), { start, end: end - 1, }));
} }
} }