Skip to content

best way to save what you love

web/fetch: use estimated-content-length if content-length is unavailable

jjd1bb1764df17
diff --git a/web/src/lib/task-manager/workers/fetch.ts b/web/src/lib/task-manager/workers/fetch.ts
index 62d05206..98c9dad2 100644
--- a/web/src/lib/task-manager/workers/fetch.ts
+++ b/web/src/lib/task-manager/workers/fetch.ts
@@ -31,8 +31,11 @@ const fetchFile = async (url: string) => {
return error("file response wasn't ok");
}
- const contentType = response.headers.get('Content-Type') || 'application/octet-stream';
- const contentLength = response.headers.get('Content-Length');
+ const contentType = response.headers.get('Content-Type')
+ || 'application/octet-stream';
+
+ const contentLength = response.headers.get('Content-Length')
+ || response.headers.get('Estimated-Content-Length');
const totalBytes = contentLength ? parseInt(contentLength, 10) : null;
const reader = response.body?.getReader();