Skip to content

Commit f6c1661

Browse files
committed
fix: clamp upload progress percentage to ensure valid range
1 parent b4e20ff commit f6c1661

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/dashboard/app/utils/uploadFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const uploadFile = async (
7777
totalLoaded += sent;
7878

7979
const speed = totalLoaded / ((Date.now() - startedAt) / 1000);
80-
const percent = Math.round((totalLoaded / file.size) * 100);
80+
const percent = clamp(Math.round((totalLoaded / file.size) * 100), 0, 100);
8181
const eta = Math.round((file.size - totalLoaded) / speed);
8282

8383
uploadingFile.status!.progress = {

0 commit comments

Comments
 (0)