mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
Fix readonly error message and push existing image bug (#4654)
This commit is contained in:
parent
dce1896d92
commit
ab4018e967
@ -43,7 +43,7 @@ func filter(req *http.Request, resp http.ResponseWriter) {
|
||||
}
|
||||
if matchRepoTagDelete(req) {
|
||||
resp.WriteHeader(http.StatusServiceUnavailable)
|
||||
_, err := 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 prohibited."))
|
||||
if err != nil {
|
||||
log.Errorf("failed to write response body: %v", err)
|
||||
}
|
||||
|
@ -160,8 +160,9 @@ type readonlyHandler struct {
|
||||
|
||||
func (rh readonlyHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
if config.ReadOnly() {
|
||||
if req.Method == http.MethodDelete || req.Method == http.MethodPost || req.Method == http.MethodPatch {
|
||||
http.Error(rw, marshalError("DENIED", "The system is in read only mode. Any modification is not prohibited."), http.StatusForbidden)
|
||||
if req.Method == http.MethodDelete || req.Method == http.MethodPost || req.Method == http.MethodPatch || req.Method == http.MethodPut {
|
||||
log.Warningf("The request is prohibited in readonly mode, url is: %s", req.URL.Path)
|
||||
http.Error(rw, marshalError("DENIED", "The system is in read only mode. Any modification is prohibited."), http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user