From a7b3abd54a9057bdac87e89dd8fc9d268eb14bcb Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sat, 30 May 2026 18:21:54 +0200 Subject: [PATCH] fix: render fresh upload progress as empty A newly selected file has no server upload record yet, so the UI calls the progress renderer with zero completed chunks and zero total chunks. Treating that zero-total state as complete made the progress bar jump to 100% before any upload had started. Render zero-total progress as empty instead. Existing resumable uploads still show their server-authoritative completed chunk percentage, and completed non-empty uploads still render as full because their completed count equals a non-zero total. Test Plan: - just static-check - just test - git diff --check --- static/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/app.js b/static/app.js index b34782d..744d6f3 100644 --- a/static/app.js +++ b/static/app.js @@ -198,7 +198,7 @@ function renderButtons() { } function updateProgress(completedCount, totalChunks) { - const percentage = totalChunks === 0 ? 100 : (completedCount / totalChunks) * 100; + const percentage = totalChunks === 0 ? 0 : (completedCount / totalChunks) * 100; progressBar.style.width = `${percentage}%`; progressMeta.textContent = `${completedCount} of ${totalChunks} chunks`; }