Skip to content

Commit bf94a81

Browse files
committed
fix(blob): ignore Content-Length mismatch if Content-Encoding set
1 parent 07437e6 commit bf94a81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/blob.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export async function download(url) {
22
const response = await fetch(url, { mode: 'cors' })
33
const reader = response.body.getReader()
44
const contentLength = +response.headers.get('Content-Length')
5+
const contentEncoding = response.headers.get('Content-Encoding')
56
console.debug('[blob] Downloading', url, contentLength)
67

78
const chunks = []
@@ -13,7 +14,7 @@ export async function download(url) {
1314

1415
const blob = new Blob(chunks)
1516
console.debug('[blob] Downloaded', url, blob.size)
16-
if (blob.size !== contentLength) console.warn('[blob] Download size mismatch', {
17+
if (!contentEncoding && blob.size !== contentLength) console.warn('[blob] Download size mismatch', {
1718
url,
1819
expected: contentLength,
1920
actual: blob.size,

0 commit comments

Comments
 (0)