Compare commits

...

1 Commits

Author SHA1 Message Date
Vaibhav Kamra
cc6bee1f15 Close response body if we error out 2023-06-27 12:14:30 -07:00

View File

@ -74,10 +74,12 @@ func downloadFile(
}
if graph.IsMalwareResp(ctx, resp) {
defer resp.Body.Close()
return nil, clues.New("malware detected").Label(graph.LabelsMalware)
}
if resp != nil && (resp.StatusCode/100) != 2 {
defer resp.Body.Close()
// upstream error checks can compare the status with
// clues.HasLabel(err, graph.LabelStatus(http.KnownStatusCode))
return nil, clues.