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