fix return
This commit is contained in:
parent
89dbed4b67
commit
9c3c67abed
14
caddywebp.go
14
caddywebp.go
|
@ -3,11 +3,6 @@ package caddywebp
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"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"
|
||||||
"image/gif"
|
"image/gif"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
|
@ -18,6 +13,12 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"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
|
const Quality = 80
|
||||||
|
@ -109,8 +110,9 @@ func (s Webp) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.H
|
||||||
case "image/gif":
|
case "image/gif":
|
||||||
decoder = decodeGif
|
decoder = decodeGif
|
||||||
default:
|
default:
|
||||||
next.ServeHTTP(w, r)
|
return next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
img, err := decoder(bytes.NewReader(resp.Body.Bytes()))
|
img, err := decoder(bytes.NewReader(resp.Body.Bytes()))
|
||||||
if err != nil || img == nil {
|
if err != nil || img == nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
|
Loading…
Reference in New Issue