Skip to content

Commit 290785d

Browse files
committed
Under report download size when compression involved
1 parent 4f5a63b commit 290785d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/file_packager.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,12 @@ def generate_js(data_target, data_files, metadata):
993993
994994
const chunks = [];
995995
const headers = response.headers;
996-
const total = Number(headers.get('Content-Length') ?? packageSize);
996+
const contentEncoding = headers.get('Content-Encoding');
997+
const isCompressed = contentEncoding === 'gzip' || contentEncoding === 'br';
998+
let total = packageSize;
999+
if (!total || (!isCompressed && headers.get('Content-Length'))) {
1000+
total = Number(headers.get('Content-Length'));
1001+
}
9971002
let loaded = 0;
9981003
9991004
const handleChunk = ({done, value}) => {

0 commit comments

Comments
 (0)