Skip to content

Commit

Permalink
Join errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MovieStoreGuy committed Sep 10, 2024
1 parent 3e986c9 commit d068cd4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions config/confighttp/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"bytes"
"compress/gzip"
"compress/zlib"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -74,10 +75,8 @@ var availableDecoders = map[string]func(body io.ReadCloser) (io.ReadCloser, erro
"lz4": func(body io.ReadCloser) (io.ReadCloser, error) {
lz := lz4.NewReader(body)
buf := new(bytes.Buffer)
if _, err := io.Copy(buf, lz); err != nil {
return nil, err
}
if err := body.Close(); err != nil {
_, err := io.Copy(buf, lz)
if err = errors.Join(err, body.Close()); err != nil {
return nil, err
}
return io.NopCloser(buf), nil
Expand Down

0 comments on commit d068cd4

Please sign in to comment.