From 096a550079e5bfee54cdb5323da8a6f56bb7c787 Mon Sep 17 00:00:00 2001 From: Saarthak Verma Date: Mon, 6 Jan 2025 01:00:30 +0530 Subject: [PATCH] fix(resume downloads): incorrect download percent on front end Signed-off-by: Saarthak Verma --- pkg/downloader/uri.go | 6 ------ pkg/downloader/uri_test.go | 1 - 2 files changed, 7 deletions(-) diff --git a/pkg/downloader/uri.go b/pkg/downloader/uri.go index 44c8625b..1d226330 100644 --- a/pkg/downloader/uri.go +++ b/pkg/downloader/uri.go @@ -324,11 +324,6 @@ func (uri URI) DownloadFile(filePath, sha string, fileN, total int, downloadStat return fmt.Errorf("failed to create / open file %q: %v", tmpFilePath, err) } defer outFile.Close() - outFileInfo, err := outFile.Stat() - if err != nil { - return fmt.Errorf("failed to get file info: %v", err) - } - fileSize := outFileInfo.Size() hash, err := calculateHashForPartialFile(outFile) if err != nil { return fmt.Errorf("failed to calculate hash for partial file") @@ -339,7 +334,6 @@ func (uri URI) DownloadFile(filePath, sha string, fileN, total int, downloadStat hash: hash, fileNo: fileN, totalFiles: total, - written: fileSize, downloadStatus: downloadStatus, } _, err = io.Copy(io.MultiWriter(outFile, progress), resp.Body) diff --git a/pkg/downloader/uri_test.go b/pkg/downloader/uri_test.go index b1bccb52..bcf13a32 100644 --- a/pkg/downloader/uri_test.go +++ b/pkg/downloader/uri_test.go @@ -131,7 +131,6 @@ var _ = Describe("Download Test", func() { err = os.Remove(filePath) // cleanup, also checks existance of filePath` Expect(err).ToNot(HaveOccurred()) }) - // It("it accurately updates progress") // It("deletes partial file if after completion hash of downloaded file doesn't match hash of the file in the server") }) })