mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Attempt to unify the disableRange
/contentLength
handling in the various network streams
First of all, note how in both `fetch_stream.js` and `node_stream.js` we always overwrite the `this._contentLength` property even when the response headers doesn't actually contain any (valid) length information. This could thus result in the `length` parameter, as passed to the network stream, being completely ignored despite having no better information available. Secondly, in `node_stream.js` the `this._isRangeSupported` property wasn't always updated correctly based on the response headers.
This commit is contained in:
parent
25293628ff
commit
ad06979cca
4 changed files with 10 additions and 13 deletions
|
@ -304,11 +304,9 @@ class PDFNodeStreamFullReader extends BaseFullReader {
|
|||
disableRange: this._disableRange,
|
||||
});
|
||||
|
||||
if (allowRangeRequests) {
|
||||
this._isRangeSupported = true;
|
||||
}
|
||||
this._isRangeSupported = allowRangeRequests;
|
||||
// Setting right content length.
|
||||
this._contentLength = suggestedLength;
|
||||
this._contentLength = suggestedLength || this._contentLength;
|
||||
|
||||
this._filename = extractFilenameFromHeader(getResponseHeader);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue