refactor: adjust file size handling in DownloadManager to ensure accurate download status updates

This commit is contained in:
Moyasee
2026-01-07 17:32:46 +02:00
parent c67b275657
commit ed3cce160f

View File

@@ -156,10 +156,13 @@ export class DownloadManager {
const { progress, downloadSpeed, bytesDownloaded, fileSize, folderName } =
status;
const finalFileSize =
fileSize && fileSize > 0 ? fileSize : download.fileSize;
const updatedDownload = {
...download,
bytesDownloaded,
fileSize,
fileSize: finalFileSize,
progress,
folderName,
status:
@@ -176,7 +179,11 @@ export class DownloadManager {
numPeers: 0,
numSeeds: 0,
downloadSpeed,
timeRemaining: calculateETA(fileSize, bytesDownloaded, downloadSpeed),
timeRemaining: calculateETA(
finalFileSize ?? 0,
bytesDownloaded,
downloadSpeed
),
isDownloadingMetadata: false,
isCheckingFiles: false,
progress,