mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-20 23:57:42 +01:00
Merge pull request #4627 from wy65701436/fix-readonly-issue
Log error when to write response body in readonly filter
This commit is contained in:
commit
1be9f9af20
@ -19,6 +19,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/astaxie/beego/context"
|
"github.com/astaxie/beego/context"
|
||||||
|
"github.com/vmware/harbor/src/common/utils/log"
|
||||||
"github.com/vmware/harbor/src/ui/config"
|
"github.com/vmware/harbor/src/ui/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,7 +43,10 @@ func filter(req *http.Request, resp http.ResponseWriter) {
|
|||||||
}
|
}
|
||||||
if matchRepoTagDelete(req) {
|
if matchRepoTagDelete(req) {
|
||||||
resp.WriteHeader(http.StatusServiceUnavailable)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user