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.
This commit is contained in:
parent
50e969f95e
commit
334883dd26
1 changed files with 4 additions and 1 deletions
|
|
@ -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 */ }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue