Skip to content

Commit

Permalink
Merge pull request #154 from kbase/dev-exhaust_reader
Browse files Browse the repository at this point in the history
Exhaust response body on file store
  • Loading branch information
MrCreosote authored Aug 3, 2024
2 parents f7af00b + f28b856 commit dd1ad42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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`

Expand Down
1 change: 1 addition & 0 deletions filestore/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dd1ad42

Please sign in to comment.