Skip to content

Commit

Permalink
fix header length
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryI committed Aug 27, 2024
1 parent fde8d16 commit 3b5f274
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 6 additions & 2 deletions Electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2783,8 +2783,12 @@ function downloadFile(file_url, targetPath, cbk) {
ft.on('response', (responce) => {
// Change the total bytes value to get progress later.
console.log(responce.headers);
total_bytes = parseInt(responce.headers.get('content-Length'));
console.log(responce.headers.get('content-Length'));
let lenHeader = responce.headers['content-Length'];
if (Array.isArray(lenHeader)) lenHeader = lenHeader[0];

if (isNaN(lenHeader)) lenHeader = 300*1024*1024;

total_bytes = parseInt(lenHeader);

responce.pipe(out);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"appId": "wljs-notebook",
"productName": "WLJS Notebook",
"copyright": "WLJS © 2024 ${author}",
"artifactName": "wljs-notebook-offline-${version}.${ext}",
"artifactName": "wljs-notebook-${version}-${arch}.${ext}",
"dmg": {
"title": "${productName} ${version}",
"icon": "./Electron/build/512x512.icns",
Expand Down

0 comments on commit 3b5f274

Please sign in to comment.