diff --git a/.yarn/cache/@mittwald-api-client-commons-npm-4.356.0-af09335a67-ac41abd764.zip b/.yarn/cache/@mittwald-api-client-commons-npm-4.360.0-19744b8c19-d0f4e090d1.zip similarity index 88% rename from .yarn/cache/@mittwald-api-client-commons-npm-4.356.0-af09335a67-ac41abd764.zip rename to .yarn/cache/@mittwald-api-client-commons-npm-4.360.0-19744b8c19-d0f4e090d1.zip index b490ae9dc..0cc401013 100644 Binary files a/.yarn/cache/@mittwald-api-client-commons-npm-4.356.0-af09335a67-ac41abd764.zip and b/.yarn/cache/@mittwald-api-client-commons-npm-4.360.0-19744b8c19-d0f4e090d1.zip differ diff --git a/.yarn/cache/@mittwald-api-client-npm-4.356.0-4214cd5b46-810efbe04a.zip b/.yarn/cache/@mittwald-api-client-npm-4.356.0-4214cd5b46-810efbe04a.zip deleted file mode 100644 index 9e58f74f3..000000000 Binary files a/.yarn/cache/@mittwald-api-client-npm-4.356.0-4214cd5b46-810efbe04a.zip and /dev/null differ diff --git a/.yarn/cache/@mittwald-api-client-npm-4.360.0-a9a6b86145-96ff226761.zip b/.yarn/cache/@mittwald-api-client-npm-4.360.0-a9a6b86145-96ff226761.zip new file mode 100644 index 000000000..6ddca46e0 Binary files /dev/null and b/.yarn/cache/@mittwald-api-client-npm-4.360.0-a9a6b86145-96ff226761.zip differ diff --git a/.yarn/cache/axios-npm-1.13.6-d50d919f38-72e94640e3.zip b/.yarn/cache/axios-npm-1.13.6-d50d919f38-72e94640e3.zip deleted file mode 100644 index 8cdbcf49d..000000000 Binary files a/.yarn/cache/axios-npm-1.13.6-d50d919f38-72e94640e3.zip and /dev/null differ diff --git a/.yarn/cache/axios-npm-1.16.0-77f999ccb9-93e8109681.zip b/.yarn/cache/axios-npm-1.16.0-77f999ccb9-93e8109681.zip new file mode 100644 index 000000000..9e316e6ab Binary files /dev/null and b/.yarn/cache/axios-npm-1.16.0-77f999ccb9-93e8109681.zip differ diff --git a/.yarn/cache/follow-redirects-npm-1.15.11-ae7b2db266-20bf55e950.zip b/.yarn/cache/follow-redirects-npm-1.15.11-ae7b2db266-20bf55e950.zip deleted file mode 100644 index dc1a208ce..000000000 Binary files a/.yarn/cache/follow-redirects-npm-1.15.11-ae7b2db266-20bf55e950.zip and /dev/null differ diff --git a/.yarn/cache/follow-redirects-npm-1.16.0-816e4f62d9-e90dce4607.zip b/.yarn/cache/follow-redirects-npm-1.16.0-816e4f62d9-e90dce4607.zip new file mode 100644 index 000000000..b6ca7b402 Binary files /dev/null and b/.yarn/cache/follow-redirects-npm-1.16.0-816e4f62d9-e90dce4607.zip differ diff --git a/.yarn/cache/proxy-from-env-npm-2.1.0-ce678f045b-b106ad790f.zip b/.yarn/cache/proxy-from-env-npm-2.1.0-ce678f045b-b106ad790f.zip new file mode 100644 index 000000000..b92f65eb1 Binary files /dev/null and b/.yarn/cache/proxy-from-env-npm-2.1.0-ce678f045b-b106ad790f.zip differ diff --git a/src/commands/backup/download.tsx b/src/commands/backup/download.tsx index 4ad43c3cf..3fd1e318a 100644 --- a/src/commands/backup/download.tsx +++ b/src/commands/backup/download.tsx @@ -159,8 +159,9 @@ export class Download extends ExecRenderBaseCommand { const downloadStep = p.addStep("downloading backup"); const resp = await axios(backupExport.downloadURL, reqConfig); + const contentLength = this.getContentLength(resp.headers["content-length"]); const size = ByteQuantity.fromBytes( - parseInt(resp.headers["content-length"] || "0", 10), + Number.isFinite(contentLength) ? contentLength : 0, ); let downloaded = ByteQuantity.fromBytes(0); @@ -205,6 +206,22 @@ export class Download extends ExecRenderBaseCommand { return { outputFilename }; } + protected getContentLength(contentLengthHeader: unknown): number { + if (typeof contentLengthHeader === "string") { + return parseInt(contentLengthHeader, 10); + } + + if (Array.isArray(contentLengthHeader)) { + return parseInt(contentLengthHeader[0] || "0", 10); + } + + if (typeof contentLengthHeader === "number") { + return contentLengthHeader; + } + + return 0; + } + protected getFilename( headers: RawAxiosResponseHeaders | AxiosResponseHeaders, ): string { diff --git a/yarn.lock b/yarn.lock index dc648eade..cc992dd9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2551,12 +2551,12 @@ __metadata: languageName: node linkType: hard -"@mittwald/api-client-commons@npm:^4.356.0": - version: 4.356.0 - resolution: "@mittwald/api-client-commons@npm:4.356.0" +"@mittwald/api-client-commons@npm:^4.360.0": + version: 4.360.0 + resolution: "@mittwald/api-client-commons@npm:4.360.0" dependencies: "@types/parse-path": ^7.0.3 - axios: ^1.13.5 + axios: ^1.15.2 parse-path: ^7.1.0 path-to-regexp: ^8.3.0 type-fest: ^4.30.0 @@ -2567,22 +2567,22 @@ __metadata: optional: true "@mittwald/react-use-promise": optional: true - checksum: ac41abd7640c1e015f180cd8fb81d155c033e851580eb7541b285552a72db8b694a0c140a8b9ac0f21cda326a27f9c9f0fd9b843859e5d3a3fb7123de7e2c6d1 + checksum: d0f4e090d1deb255c25c63b322e64eae9292bd6124bb220b09523309f9c7518a85f88fa33e06cc9e18cb7f78d86bf0a0596dfc8bc6bbc85a156a7d79f64a33b8 languageName: node linkType: hard "@mittwald/api-client@npm:^4.131.0": - version: 4.356.0 - resolution: "@mittwald/api-client@npm:4.356.0" + version: 4.360.0 + resolution: "@mittwald/api-client@npm:4.360.0" dependencies: - "@mittwald/api-client-commons": ^4.356.0 + "@mittwald/api-client-commons": ^4.360.0 browser-or-node: ^3.0.0 peerDependencies: "@mittwald/react-use-promise": ^2.6.0 peerDependenciesMeta: "@mittwald/react-use-promise": optional: true - checksum: 810efbe04a23cc20de3f4bbec1c74c33aaf4677a96f22bfe74f1f5d00983ce443b79f95beeb3890cb939a4d5fbf5f593a9a676cdcf99962ad1b69a04b263a690 + checksum: 96ff226761cbc0e43de97fc694267d837f83fb098a5da4f8d01ce68d6dc53e8bf9c11ae8fb2e95b177a5190fcdf86ebdd09d1370e2ee58c6439bae3d6013980a languageName: node linkType: hard @@ -4769,14 +4769,14 @@ __metadata: languageName: node linkType: hard -"axios@npm:^1.13.5": - version: 1.13.6 - resolution: "axios@npm:1.13.6" +"axios@npm:^1.15.2": + version: 1.16.0 + resolution: "axios@npm:1.16.0" dependencies: - follow-redirects: ^1.15.11 + follow-redirects: ^1.16.0 form-data: ^4.0.5 - proxy-from-env: ^1.1.0 - checksum: 72e94640e34aa9b591a47a9cc1798a1e18f179e15e39276514dd73f6d910981bdb2117c649da858bd72fc34d91db4f84318f88c8d306e395cd4ef5d6f142ab70 + proxy-from-env: ^2.1.0 + checksum: 93e810968167fea59750d28f458e6860973a573c14bd60fe57ee07b5241f4c16991b149ae9ce65d79765081e3004743c9e158c438edba75af6f4612197e6834b languageName: node linkType: hard @@ -6444,13 +6444,13 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.11": - version: 1.15.11 - resolution: "follow-redirects@npm:1.15.11" +"follow-redirects@npm:^1.16.0": + version: 1.16.0 + resolution: "follow-redirects@npm:1.16.0" peerDependenciesMeta: debug: optional: true - checksum: 20bf55e9504f59e6cc3743ba27edb2ebf41edea1baab34799408f2c050f73f0c612728db21c691276296d2795ea8a812dc532a98e8793619fcab91abe06d017f + checksum: e90dce4607b1f6b8b9883287f912585573c19088209ad82341d550a795b4ba514522b73b1b340cf618279df27975cd46504d09149be60291ba6767384c1fd8f8 languageName: node linkType: hard @@ -9633,6 +9633,13 @@ __metadata: languageName: node linkType: hard +"proxy-from-env@npm:^2.1.0": + version: 2.1.0 + resolution: "proxy-from-env@npm:2.1.0" + checksum: b106ad790f26d47ba4791af3fe8cba5c8d35d85020119c82c05b413eb11b3ab97d2393ecaed51bca97c2788fa256408283dfeb4d970b2ebcae6702310f064e7e + languageName: node + linkType: hard + "pump@npm:^3.0.0": version: 3.0.3 resolution: "pump@npm:3.0.3"