bugfix
Some checks failed
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2026-02-11 11:52:34 +11:00
parent a23cc7a183
commit 43a9cf5a7e
11 changed files with 90 additions and 19 deletions

View File

@@ -282,15 +282,23 @@ func downloadFileFromServer(providerURL string) (filename string, body []byte, e
return
}
resp, err := http.Get(providerURL)
req, err := http.NewRequest(http.MethodGet, providerURL, nil)
if err != nil {
return
}
resp.Header.Set("User-Agent", Settings.UserAgent)
req.Header.Set("User-Agent", getUserAgent())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
err = fmt.Errorf(fmt.Sprintf("%d: %s "+http.StatusText(resp.StatusCode), resp.StatusCode, providerURL))
err = fmt.Errorf("%d: %s %s", resp.StatusCode, providerURL, http.StatusText(resp.StatusCode))
return
}