尝试修复进度为0时仍然显示下载完成的问题(#2471)

This commit is contained in:
lyswhut
2025-08-05 12:16:24 +08:00
parent 3d64ca37e7
commit 49c8081f68
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -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