From 334883dd265d8aafd1a8a3572101c5dd0b772f38 Mon Sep 17 00:00:00 2001 From: Claus Lohmar Date: Thu, 23 Jul 2026 08:12:21 +0000 Subject: [PATCH] fix: show download progress bar percentage when content_length is known Previously always showed indeterminate spinner (pct=0) because total size was unknown. Now if the HEAD request returns Content-Length, the progress bar fills proportionally. --- frontend/templates/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/templates/index.html b/frontend/templates/index.html index b006d78..b90ee5f 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -218,7 +218,10 @@ async function handleDownload(formData) { let label = 'Downloading source file... ' + gb + ' GiB'; if (pdata.speed_mbps) label += ' (' + pdata.speed_mbps + ' MB/s)'; if (pdata.eta) label += ' — ' + pdata.eta; - setPhase(label, 0, true); + // Show percentage if we know total size + const totalGb = pdata.content_length_gb; + const pct = totalGb ? Math.round((pdata.file_size_gb / totalGb) * 100) : 0; + setPhase(label, pct, totalGb ? false : true); } } catch (_) { /* keep polling */ } }