Skip to content

Commit 2f154ad

Browse files
authored
Disable timeout for downloading files (#123)
1 parent a3b322c commit 2f154ad

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pkg/appstore/appstore_download.go

+6
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ func (a *appstore) downloadFile(dst, sourceURL string) (err error) {
174174
return errors.Wrap(err, ErrOpenFile.Error())
175175
}
176176

177+
defer func() {
178+
if closeErr := file.Close(); closeErr != err && err == nil {
179+
err = closeErr
180+
}
181+
}()
182+
177183
sizeMB := float64(res.ContentLength) / (1 << 20)
178184
a.logger.Verbose().Str("size", fmt.Sprintf("%.2fMB", sizeMB)).Msg("downloading")
179185

pkg/http/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (c *client[R]) Send(req Request) (Result[R], error) {
7878
}
7979

8080
func (c *client[R]) Do(req *http.Request) (*http.Response, error) {
81-
return c.internalClient.Do(req)
81+
return http.DefaultClient.Do(req)
8282
}
8383

8484
func (*client[R]) NewRequest(method, url string, body io.Reader) (*http.Request, error) {

0 commit comments

Comments
 (0)