Skip to content

Commit 9ca2fae

Browse files
fix(metadata): file closed too early (#273)
This fixes an issue where the metadata provider closed a file that may still be in use. Fixes #264
1 parent 2b83ee0 commit 9ca2fae

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

metadata/decode.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ func (d *Decoder) Parse(payload *PayloadJSON) (metadata *Metadata, err error) {
8080
return metadata, nil
8181
}
8282

83-
// Decode the blob from an io.ReadCloser. This function will close the io.ReadCloser after completing.
84-
func (d *Decoder) Decode(r io.ReadCloser) (payload *PayloadJSON, err error) {
85-
defer r.Close()
86-
83+
// Decode the blob from an io.Reader. This function will close the io.ReadCloser after completing.
84+
func (d *Decoder) Decode(r io.Reader) (payload *PayloadJSON, err error) {
8785
bytes, err := io.ReadAll(r)
8886
if err != nil {
8987
return nil, err

0 commit comments

Comments
 (0)