From d005ff941f180e6d9a6f3e83fa8654a3fd9bcebf Mon Sep 17 00:00:00 2001 From: wangyan Date: Tue, 10 Apr 2018 23:00:17 -0700 Subject: [PATCH] log error when to write response body in readonly filter --- src/ui/filter/readonly.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/filter/readonly.go b/src/ui/filter/readonly.go index a734d5f09..c25aa80f0 100644 --- a/src/ui/filter/readonly.go +++ b/src/ui/filter/readonly.go @@ -19,6 +19,7 @@ import ( "regexp" "github.com/astaxie/beego/context" + "github.com/vmware/harbor/src/common/utils/log" "github.com/vmware/harbor/src/ui/config" ) @@ -42,7 +43,10 @@ func filter(req *http.Request, resp http.ResponseWriter) { } if matchRepoTagDelete(req) { resp.WriteHeader(http.StatusServiceUnavailable) - resp.Write([]byte("The system is in read only mode. Any modification is not prohibited.")) + _, err := resp.Write([]byte("The system is in read only mode. Any modification is not prohibited.")) + if err != nil { + log.Errorf("failed to write response body: %v", err) + } } }