From 3b5f27478733730021a4c270b67cd28312de3762 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Tue, 27 Aug 2024 17:54:49 +0200 Subject: [PATCH] fix header length --- .DS_Store | Bin 18436 -> 18436 bytes Electron/main.js | 8 ++++++-- package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.DS_Store b/.DS_Store index c7cee2ae22f8e34c923ba91c14eb51ff34ce8b52..abeb1a4eb842484e7eaaea774ad00d9a97fb5100 100644 GIT binary patch delta 167 zcmZpfz}PZ@ae_ai>&AfH@{IDEc@(}ePBt@h+3cny#K_Oi5D$cT3?&Sy47m&ilNp5@ zK$3C{3=C*eWx+*xIr(|%KpDo(p~{E2H**^VGBfU+Ji(-pTe7;^(7;qj!Pwk*vaOj6 uWB25Xs`89IlSNEEfbH@yHDa7BXr{V(t!gskW)_P+w$1ZYi-0T#C<_4kpfAP% delta 120 zcmZpfz}PZ@ae_ai^TvSP@{F>Zc@(}e@*5lJD3};q*6Ju!8=4qcOr9WYvDs6JpK)@9 z3h(Afl}+3e8@_DjHV9;%tRzv&W@@3MU|})Y-b`llP6?ICk|u8_Z_#z%>}#sexH(U~ Ui*YlHMIYPdHuWMP%K^#)0Mi#HD*ylh diff --git a/Electron/main.js b/Electron/main.js index ed4959a5..5134c6d6 100644 --- a/Electron/main.js +++ b/Electron/main.js @@ -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); diff --git a/package.json b/package.json index 63456bbd..07ade109 100644 --- a/package.json +++ b/package.json @@ -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",