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:
|
default:
|
||||||
n, err := resp.Body.Read(buffer)
|
n, err := resp.Body.Read(buffer)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
|
resp.Body.Close()
|
||||||
|
file.Close()
|
||||||
if doRetries && attempt < maxRetries {
|
if doRetries && attempt < maxRetries {
|
||||||
time.Sleep(retryDelay)
|
time.Sleep(retryDelay)
|
||||||
isError = true
|
isError = true
|
||||||
break Loop
|
break Loop
|
||||||
}
|
}
|
||||||
resp.Body.Close()
|
|
||||||
file.Close()
|
|
||||||
return fmt.Errorf("download error after %d attempts: %+v", attempt, err)
|
return fmt.Errorf("download error after %d attempts: %+v", attempt, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
|
file.Close()
|
||||||
break Loop
|
break Loop
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = file.Write(buffer[:n])
|
_, err = file.Write(buffer[:n])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
resp.Body.Close()
|
||||||
|
file.Close()
|
||||||
if doRetries && attempt < maxRetries {
|
if doRetries && attempt < maxRetries {
|
||||||
time.Sleep(retryDelay)
|
time.Sleep(retryDelay)
|
||||||
isError = true
|
isError = true
|
||||||
break Loop
|
break Loop
|
||||||
}
|
}
|
||||||
resp.Body.Close()
|
|
||||||
file.Close()
|
|
||||||
return fmt.Errorf("write error after %d attempts: %+v", attempt, err)
|
return fmt.Errorf("write error after %d attempts: %+v", attempt, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue