From 051acc89c332e7d146b18937b00c05d8cc6982a9 Mon Sep 17 00:00:00 2001 From: shortcut Date: Mon, 25 Jul 2022 15:30:14 -0400 Subject: [PATCH] fix return --- caddywebp.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/caddywebp.go b/caddywebp.go index c67f247..60ddec8 100644 --- a/caddywebp.go +++ b/caddywebp.go @@ -125,18 +125,18 @@ func (s Webp) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.H return next.ServeHTTP(w, r) } - + b:=buf.Bytes() fh,err:=os.Create(cacheFile) - fh.Write(buf.Bytes()) + fh.Write(b) - buf.WriteTo(fh) +// buf.WriteTo(fh) fh.Close() w.Header().Set("content-Type", "image/webp") w.Header().Add("webpstatus", "tocache") w.WriteHeader(http.StatusOK) - w.Write(buf.Bytes()) - buf.WriteTo(w) + w.Write(b) +// buf.WriteTo(w) return nil }