mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-30 22:37:43 +02:00
Update to use placeholder
This commit is contained in:
parent
aa9fa581ec
commit
cea9cca52a
@ -43,7 +43,7 @@ func (n *NotificationHandler) Post() {
|
|||||||
err := json.Unmarshal(n.Ctx.Input.CopyBody(1<<32), ¬ification)
|
err := json.Unmarshal(n.Ctx.Input.CopyBody(1<<32), ¬ification)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("error while decoding json: ", err)
|
log.Errorf("error while decoding json: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var username, action, repo, project string
|
var username, action, repo, project string
|
||||||
@ -51,7 +51,7 @@ func (n *NotificationHandler) Post() {
|
|||||||
for _, e := range notification.Events {
|
for _, e := range notification.Events {
|
||||||
matched, err = regexp.MatchString(manifestPattern, e.Target.MediaType)
|
matched, err = regexp.MatchString(manifestPattern, e.Target.MediaType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to match the media type against pattern, error: ", err)
|
log.Errorf("Failed to match the media type against pattern, error: %v", err)
|
||||||
matched = false
|
matched = false
|
||||||
}
|
}
|
||||||
if matched && strings.HasPrefix(e.Request.UserAgent, "docker") {
|
if matched && strings.HasPrefix(e.Request.UserAgent, "docker") {
|
||||||
@ -69,7 +69,7 @@ func (n *NotificationHandler) Post() {
|
|||||||
go func() {
|
go func() {
|
||||||
err2 := svc_utils.RefreshCatalogCache()
|
err2 := svc_utils.RefreshCatalogCache()
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
log.Error("Error happens when refreshing cache:", err2)
|
log.Errorf("Error happens when refreshing cache: %v", err2)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ type TokenHandler struct {
|
|||||||
func (a *TokenHandler) Get() {
|
func (a *TokenHandler) Get() {
|
||||||
|
|
||||||
request := a.Ctx.Request
|
request := a.Ctx.Request
|
||||||
log.Infof("request url: " + request.URL.String())
|
log.Infof("request url: %v", request.URL.String())
|
||||||
username, password, _ := request.BasicAuth()
|
username, password, _ := request.BasicAuth()
|
||||||
authenticated := authenticate(username, password)
|
authenticated := authenticate(username, password)
|
||||||
service := a.GetString("service")
|
service := a.GetString("service")
|
||||||
|
@ -78,7 +78,7 @@ func FilterAccess(username string, authenticated bool, a *token.ResourceActions)
|
|||||||
permission = "RW"
|
permission = "RW"
|
||||||
} else {
|
} else {
|
||||||
permission = ""
|
permission = ""
|
||||||
log.Infof("project %s does not exist, set empty permission for admin", projectName)
|
log.Infof("project %s does not exist, set empty permission for admin\n", projectName)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
permission, err = dao.GetPermission(username, projectName)
|
permission, err = dao.GetPermission(username, projectName)
|
||||||
|
@ -34,7 +34,7 @@ func init() {
|
|||||||
var err error
|
var err error
|
||||||
Cache, err = cache.NewCache("memory", `{"interval":720}`)
|
Cache, err = cache.NewCache("memory", `{"interval":720}`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to initialize cache, error:", err)
|
log.Errorf("Failed to initialize cache, error:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ func RegistryAPIGet(url, username string) ([]byte, error) {
|
|||||||
} else if response.StatusCode == http.StatusUnauthorized {
|
} else if response.StatusCode == http.StatusUnauthorized {
|
||||||
authenticate := response.Header.Get("WWW-Authenticate")
|
authenticate := response.Header.Get("WWW-Authenticate")
|
||||||
str := strings.Split(authenticate, " ")[1]
|
str := strings.Split(authenticate, " ")[1]
|
||||||
log.Debugf("url: " + url)
|
log.Debugf("url: %s", url)
|
||||||
var service string
|
var service string
|
||||||
var scope string
|
var scope string
|
||||||
strs := strings.Split(str, ",")
|
strs := strings.Split(str, ",")
|
||||||
|
Loading…
Reference in New Issue
Block a user