diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c1c0742..613eaf8 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,7 @@ # 0.1.5 +* Fixed a bug where the response input stream from S3 may not be fully exhausted when + storing a file. * Upgraded from go 1.12 to 1.16, which is now required * Changed build base image from FROM `golang:1.12.5-alpine3.9` to `golang:1.16.15-alpine3.15` diff --git a/filestore/s3.go b/filestore/s3.go index 4cad268..cb819e8 100644 --- a/filestore/s3.go +++ b/filestore/s3.go @@ -151,6 +151,7 @@ func (fs *S3FileStore) StoreFile(le *logrus.Entry, p *StoreFileParams) (out *Fil return nil, errors.New("s3 store request: " + errstr) } defer resp.Body.Close() + defer io.Copy(io.Discard, resp.Body) if resp.StatusCode > 399 { // don't worry about 100s, shouldn't happen buffer := make([]byte, 1000) n, err := resp.Body.Read(buffer)