mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-04 17:22:40 +02:00
lint: improve error handling
This commit is contained in:
parent
ef8aec77a9
commit
a81add5d96
6 changed files with 9 additions and 5 deletions
|
|
@ -276,7 +276,7 @@ func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) {
|
|||
// the content type. Returns empty string if error occurs.
|
||||
func peekContentType(p *bufio.Reader) string {
|
||||
byt, err := p.Peek(512)
|
||||
if err != nil && err != bufio.ErrBufferFull && err != io.EOF {
|
||||
if err != nil && !errors.Is(err, bufio.ErrBufferFull) && !errors.Is(err, io.EOF) {
|
||||
return ""
|
||||
}
|
||||
return http.DetectContentType(byt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue