Skip to content

Commit

Permalink
Merge pull request #3 from littleneko/dev
Browse files Browse the repository at this point in the history
[bugfix] handle download error
  • Loading branch information
littleneko authored May 7, 2023
2 parents 0c4fc6f + 5e08c7c commit f8b87f0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func WriteFileAndCalHash(reader io.Reader, filename string, hashType HashType) (
r := io.TeeReader(reader, h)

size, err := io.Copy(file, r)
if err != nil {
return 0, "", err
}
sum := fmt.Sprintf("%x", h.Sum(nil))
return size, sum, nil
}
Expand Down

0 comments on commit f8b87f0

Please sign in to comment.