mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-23 03:27:12 -04:00
Fix oversight
This commit is contained in:
parent
bea31a1ab7
commit
02be2175be
1 changed files with 5 additions and 4 deletions
|
@ -100,30 +100,31 @@ func downloadFile(ctx context.Context, progressReporter ProgressReporter, client
|
|||
default:
|
||||
n, err := resp.Body.Read(buffer)
|
||||
if err != nil && err != io.EOF {
|
||||
resp.Body.Close()
|
||||
file.Close()
|
||||
if doRetries && attempt < maxRetries {
|
||||
time.Sleep(retryDelay)
|
||||
isError = true
|
||||
break Loop
|
||||
}
|
||||
resp.Body.Close()
|
||||
file.Close()
|
||||
return fmt.Errorf("download error after %d attempts: %+v", attempt, err)
|
||||
}
|
||||
|
||||
if n == 0 {
|
||||
resp.Body.Close()
|
||||
file.Close()
|
||||
break Loop
|
||||
}
|
||||
|
||||
_, err = file.Write(buffer[:n])
|
||||
if err != nil {
|
||||
resp.Body.Close()
|
||||
file.Close()
|
||||
if doRetries && attempt < maxRetries {
|
||||
time.Sleep(retryDelay)
|
||||
isError = true
|
||||
break Loop
|
||||
}
|
||||
resp.Body.Close()
|
||||
file.Close()
|
||||
return fmt.Errorf("write error after %d attempts: %+v", attempt, err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue