Skip to content

Commit

Permalink
Merge pull request #19010 from CyberAndrii/18957-fix-error-on-empty-r…
Browse files Browse the repository at this point in the history
…esponse-headers

Fix error on empty response headers
  • Loading branch information
Snuffleupagus authored Nov 5, 2024
2 parents cefd1eb + 824a619 commit cbb02eb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/display/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,17 @@ class PDFNetworkStreamFullRequestReader {
const fullRequestXhrId = this._fullRequestId;
const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);

const rawResponseHeaders = fullRequestXhr.getAllResponseHeaders();
const responseHeaders = new Headers(
fullRequestXhr
.getAllResponseHeaders()
.trim()
.split(/[\r\n]+/)
.map(x => {
const [key, ...val] = x.split(": ");
return [key, val.join(": ")];
})
rawResponseHeaders
? rawResponseHeaders
.trim()
.split(/[\r\n]+/)
.map(x => {
const [key, ...val] = x.split(": ");
return [key, val.join(": ")];
})
: []
);

const { allowRangeRequests, suggestedLength } =
Expand Down

0 comments on commit cbb02eb

Please sign in to comment.