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 fullRequestXhrId = this._fullRequestId;
const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
const rawResponseHeaders = fullRequestXhr.getAllResponseHeaders();
const responseHeaders = new Headers( const responseHeaders = new Headers(
fullRequestXhr rawResponseHeaders
.getAllResponseHeaders() ? rawResponseHeaders
.trim() .trim()
.split(/[\r\n]+/) .split(/[\r\n]+/)
.map(x => { .map(x => {
const [key, ...val] = x.split(": "); const [key, ...val] = x.split(": ");
return [key, val.join(": ")]; return [key, val.join(": ")];
}) })
: []
); );
const { allowRangeRequests, suggestedLength } = const { allowRangeRequests, suggestedLength } =