fix(package): [netutil] reject failed download responses (#388)

This commit is contained in:
Yusuf Efe authored and GitHub committed 2026-10-22 10:48:00 +08:00
1 parent be9b167a9b
commit f1db13387b
2 files changed
+43

No files matched your search

+3
View File
@@ -288,6 +288,9 @@ func DownloadFile(filepath string, url string) error {
return err
}
defer resp.Body.Close()
if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
return fmt.Errorf("download failed: %s", resp.Status)
}
out, err := os.Create(filepath)
if err != nil {