avoid network read errors crashing CreateFile call (#11939)

Thanks to @dvaldivia for reproducing this
This commit is contained in:
Harshavardhana 2021-03-31 18:44:45 -07:00
parent cf87303094
commit 3242847ec0

View file

@ -340,9 +340,8 @@ func (client *storageRESTClient) CreateFile(ctx context.Context, volume, path st
if err != nil {
return err
}
waitReader, err := waitForHTTPResponse(respBody)
defer http.DrainBody(ioutil.NopCloser(waitReader))
defer respBody.Close()
_, err = waitForHTTPResponse(respBody)
defer http.DrainBody(respBody)
return err
}