From 49c8081f68da4c298870c358b32cfc4edd33ebe6 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Tue, 5 Aug 2025 12:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E4=B8=BA0=E6=97=B6=E4=BB=8D=E7=84=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8B=E8=BD=BD=E5=AE=8C=E6=88=90=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=88#2471=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 4 ++++ src/common/utils/download/Downloader.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/publish/changeLog.md b/publish/changeLog.md index e3d84aa8..a47d79f5 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -6,6 +6,10 @@ - 新增「设置 → 播放设置 → 调换翻译歌词与罗马音歌词位置」设置,默认关闭(#2451) - 新增启动参数 `-hidden`,在启动时将软件最小化到系统托盘(#2459) +### 修复 + +- 尝试修复进度为0时仍然显示下载完成的问题(#2471) + ### 变更 - 调换 翻译歌词 与 罗马音歌词的位置,若你想要恢复默认的行为,可以开启 调换翻译歌词与罗马音歌词位置 设置 diff --git a/src/common/utils/download/Downloader.ts b/src/common/utils/download/Downloader.ts index 978a8754..d382ea1d 100644 --- a/src/common/utils/download/Downloader.ts +++ b/src/common/utils/download/Downloader.ts @@ -230,6 +230,11 @@ class Task extends EventEmitter { __handleComplete() { if (this.status == STATUS.error) return this.__clearTimeout() + if (this.progress.progress <= 0) { + this.status = STATUS.error + this.emit('error', new Error('Progress is 0, download failed.')) + return + } void this.__closeWriteStream().then(() => { if (this.progress.downloaded == this.progress.total) { this.status = STATUS.completed