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 committed by GitHub
parent f60eaabfcd
commit 3c571472e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}