Skip to content

Commit

Permalink
fix ammo uri uris panic
Browse files Browse the repository at this point in the history
fix ammo uri uris panic
  • Loading branch information
oke11o committed May 4, 2023
1 parent 03cee2f commit 19ef8ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/providers/http/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ func fileReadSeekCloser(fs afero.Fs, path string) (io.ReadSeeker, io.Closer, err
return file, file, nil
}

type fakeCloser struct {
}

func (fc *fakeCloser) Close() error {
return nil
}

func uriReadSeekCloser(conf config.Config) (io.ReadSeeker, io.Closer, error) {
if conf.Decoder != config.DecoderURI {
return nil, nil, xerrors.Errorf("'uris' expect setted only for 'uri' decoder, but faced with '%s'", conf.Decoder)
Expand All @@ -73,5 +80,6 @@ func uriReadSeekCloser(conf config.Config) (io.ReadSeeker, io.Closer, error) {
}
reader := bytes.NewReader([]byte(strings.Join(conf.Uris, "\n")))
readSeeker := io.ReadSeeker(reader)
return readSeeker, nil, nil

return readSeeker, &fakeCloser{}, nil
}

0 comments on commit 19ef8ea

Please sign in to comment.