Skip to content

Commit f22fb6b

Browse files
Merge pull request #20652 from Snuffleupagus/ChunkedStream-sendRequest-skip-empty
Avoid parsing skipped range requests in `ChunkedStreamManager` (PR 10694 follow-up)
2 parents fa908e4 + b3c07f4 commit f22fb6b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/core/chunked_stream.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,11 @@ class ChunkedStreamManager {
301301
const readChunk = ({ value, done }) => {
302302
try {
303303
if (done) {
304-
resolve(arrayBuffersToBytes(chunks));
304+
resolve(
305+
chunks.length > 0 || !this.disableAutoFetch
306+
? arrayBuffersToBytes(chunks)
307+
: null
308+
);
305309
chunks = null;
306310
return;
307311
}
@@ -322,6 +326,11 @@ class ChunkedStreamManager {
322326
if (this.aborted) {
323327
return; // Ignoring any data after abort.
324328
}
329+
if (!data) {
330+
// The range request wasn't dispatched, see the "GetRangeReader" handler
331+
// in the `src/display/api.js` file.
332+
return;
333+
}
325334
this.onReceiveData({ chunk: data.buffer, begin });
326335
});
327336
}

0 commit comments

Comments
 (0)