This commit is contained in:
Manav Rathi 2024-05-11 13:50:06 +05:30
parent 8f6da1ec35
commit e8c2717bf7
No known key found for this signature in database

View file

@ -361,9 +361,14 @@ class DownloadManagerImpl {
buffer.set(new Uint8Array(data), 0);
buffer.set(new Uint8Array(value), data.byteLength);
// Note that buffer.length might be a multiple of
// decryptionChunkSizes. We let that accumulate, and
// drain it all with a while loop when done.
if (buffer.length > decryptionChunkSize) {
const fileData = new Uint8Array(
buffer.slice(0, decryptionChunkSize),
const fileData = buffer.slice(
0,
decryptionChunkSize,
);
const { decryptedData } =
@ -372,11 +377,9 @@ class DownloadManagerImpl {
pullState,
);
controller.enqueue(decryptedData);
data = new Uint8Array(
buffer.slice(decryptionChunkSize),
);
data = buffer.slice(decryptionChunkSize);
} else {
data = new Uint8Array(buffer);
data = buffer;
}
more = true;
} else {