Skip to content

Commit

Permalink
fix(metadata): file closed too early (#273)
Browse files Browse the repository at this point in the history
This fixes an issue where the metadata provider closed a file that may still be in use.

Fixes #264
  • Loading branch information
james-d-elliott authored Aug 6, 2024
1 parent 2b83ee0 commit 9ca2fae
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions metadata/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ func (d *Decoder) Parse(payload *PayloadJSON) (metadata *Metadata, err error) {
return metadata, nil
}

// Decode the blob from an io.ReadCloser. This function will close the io.ReadCloser after completing.
func (d *Decoder) Decode(r io.ReadCloser) (payload *PayloadJSON, err error) {
defer r.Close()

// Decode the blob from an io.Reader. This function will close the io.ReadCloser after completing.
func (d *Decoder) Decode(r io.Reader) (payload *PayloadJSON, err error) {
bytes, err := io.ReadAll(r)
if err != nil {
return nil, err
Expand Down

0 comments on commit 9ca2fae

Please sign in to comment.