fix return

This commit is contained in:
shortcut 2022-07-25 15:14:46 -04:00
parent 89dbed4b67
commit 9c3c67abed
1 changed files with 8 additions and 6 deletions

View File

@ -3,11 +3,6 @@ package caddywebp
import (
"bytes"
"fmt"
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
"github.com/chai2010/webp"
"golang.org/x/image/bmp"
"image"
"image/gif"
"image/jpeg"
@ -18,6 +13,12 @@ import (
"os"
"path"
"strings"
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
"github.com/chai2010/webp"
"golang.org/x/image/bmp"
)
const Quality = 80
@ -109,8 +110,9 @@ func (s Webp) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.H
case "image/gif":
decoder = decodeGif
default:
next.ServeHTTP(w, r)
return next.ServeHTTP(w, r)
}
img, err := decoder(bytes.NewReader(resp.Body.Bytes()))
if err != nil || img == nil {
log.Println(err)