Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

fix: ensure progress percentage is non-negative in upsertProgress and syncQueueState functions

Tonhoad6b75ee95c9
diff --git a/src/lib/stores/download-store.svelte.ts b/src/lib/stores/download-store.svelte.ts
index 8004047d..df4431e5 100644
--- a/src/lib/stores/download-store.svelte.ts
+++ b/src/lib/stores/download-store.svelte.ts
@@ -108,7 +108,7 @@ export function upsertProgress(
kind: "course",
id: courseId,
name: courseName,
- percent,
+ percent: Math.max(0, percent),
currentModule,
currentPage,
status: "downloading",
@@ -227,7 +227,7 @@ export function syncQueueState(items: QueueItemInfo[]) {
id: qi.id,
name: qi.title,
platform: qi.platform,
- percent: qi.percent,
+ percent: Math.max(0, qi.percent),
speed: dlStatus === "downloading" ? speed : 0,
downloadedBytes: qi.downloaded_bytes,
totalBytes: qi.total_bytes,
@@ -293,7 +293,7 @@ export function upsertGenericProgress(
id,
name: title,
platform,
- percent,
+ percent: Math.max(0, percent),
speed,
downloadedBytes,
totalBytes,