mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-29 22:20:43 +00:00
fix(resume downloads): incorrect download percent on front end
Signed-off-by: Saarthak Verma <saarthakverma739@gmail.com>
This commit is contained in:
parent
9966198289
commit
096a550079
2 changed files with 0 additions and 7 deletions
|
@ -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)
|
return fmt.Errorf("failed to create / open file %q: %v", tmpFilePath, err)
|
||||||
}
|
}
|
||||||
defer outFile.Close()
|
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)
|
hash, err := calculateHashForPartialFile(outFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to calculate hash for partial file")
|
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,
|
hash: hash,
|
||||||
fileNo: fileN,
|
fileNo: fileN,
|
||||||
totalFiles: total,
|
totalFiles: total,
|
||||||
written: fileSize,
|
|
||||||
downloadStatus: downloadStatus,
|
downloadStatus: downloadStatus,
|
||||||
}
|
}
|
||||||
_, err = io.Copy(io.MultiWriter(outFile, progress), resp.Body)
|
_, err = io.Copy(io.MultiWriter(outFile, progress), resp.Body)
|
||||||
|
|
|
@ -131,7 +131,6 @@ var _ = Describe("Download Test", func() {
|
||||||
err = os.Remove(filePath) // cleanup, also checks existance of filePath`
|
err = os.Remove(filePath) // cleanup, also checks existance of filePath`
|
||||||
Expect(err).ToNot(HaveOccurred())
|
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")
|
// It("deletes partial file if after completion hash of downloaded file doesn't match hash of the file in the server")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue