From d7aa2da273dc832509971eb91c2c7c8dbebce248 Mon Sep 17 00:00:00 2001 From: Patrick Gaskin Date: Fri, 22 May 2020 23:01:30 -0400 Subject: [PATCH] Fixed error being logged for every request --- webdav.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webdav.go b/webdav.go index 231a2f2..40ba04d 100644 --- a/webdav.go +++ b/webdav.go @@ -76,10 +76,12 @@ func (wd WebDAV) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhtt FileSystem: webdav.Dir(root), LockSystem: wd.lockSystem, Logger: func(req *http.Request, err error) { - wd.logger.Error("internal handler error", - zap.Error(err), - zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: req}), - ) + if err != nil { + wd.logger.Error("internal handler error", + zap.Error(err), + zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: req}), + ) + } }, }