1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #19010 from CyberAndrii/18957-fix-error-on-empty-response-headers

Fix error on empty response headers
This commit is contained in:
Jonas Jenwald 2024-11-05 21:22:29 +01:00 committed by GitHub
commit cbb02eb655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 } =