mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 12:46:03 +01:00
bug fix
This commit is contained in:
parent
6fa12cdb1e
commit
0de64ed139
@ -79,11 +79,14 @@ func IncreasePullCount(name string) (err error) {
|
|||||||
"pull_count": orm.ColValue(orm.ColAdd, 1),
|
"pull_count": orm.ColValue(orm.ColAdd, 1),
|
||||||
"update_time": time.Now(),
|
"update_time": time.Now(),
|
||||||
})
|
})
|
||||||
if num == 0 {
|
if err != nil {
|
||||||
err = fmt.Errorf("Failed to increase repository pull count with name: %s %s", name, err.Error())
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if num == 0 {
|
||||||
|
return fmt.Errorf("Failed to increase repository pull count with name: %s", name)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
//RepositoryExists returns whether the repository exists according to its name.
|
//RepositoryExists returns whether the repository exists according to its name.
|
||||||
func RepositoryExists(name string) bool {
|
func RepositoryExists(name string) bool {
|
||||||
|
@ -48,6 +48,9 @@ func GetSystemLdapConf() (models.LdapConf, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ldap, err := config.LDAP()
|
ldap, err := config.LDAP()
|
||||||
|
if err != nil {
|
||||||
|
return ldapConfs, err
|
||||||
|
}
|
||||||
|
|
||||||
ldapConfs.LdapURL = ldap.URL
|
ldapConfs.LdapURL = ldap.URL
|
||||||
ldapConfs.LdapSearchDn = ldap.SearchDN
|
ldapConfs.LdapSearchDn = ldap.SearchDN
|
||||||
|
@ -164,6 +164,9 @@ func (s *standardTokenAuthorizer) generateToken(realm, service string, scopes []
|
|||||||
realm = s.tokenURL(realm)
|
realm = s.tokenURL(realm)
|
||||||
tk, err := getToken(s.client, s.credential, realm,
|
tk, err := getToken(s.client, s.credential, realm,
|
||||||
service, scopes)
|
service, scopes)
|
||||||
|
if err != nil {
|
||||||
|
return "", 0, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
if len(tk.IssuedAt) == 0 {
|
if len(tk.IssuedAt) == 0 {
|
||||||
return tk.Token, tk.ExpiresIn, nil, nil
|
return tk.Token, tk.ExpiresIn, nil, nil
|
||||||
|
@ -64,6 +64,8 @@ func (pma *ProjectMemberAPI) Prepare() {
|
|||||||
} else {
|
} else {
|
||||||
text += fmt.Sprintf("%d", pid)
|
text += fmt.Sprintf("%d", pid)
|
||||||
}
|
}
|
||||||
|
pma.HandleBadRequest(text)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
project, err := pma.ProjectMgr.Get(pid)
|
project, err := pma.ProjectMgr.Get(pid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -70,6 +70,10 @@ func (n *NotificationHandler) Post() {
|
|||||||
log.Errorf("failed to get project by name %s: %v", project, err)
|
log.Errorf("failed to get project by name %s: %v", project, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if pro == nil {
|
||||||
|
log.Warningf("project %s not found", project)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := dao.AddAccessLog(models.AccessLog{
|
if err := dao.AddAccessLog(models.AccessLog{
|
||||||
|
Loading…
Reference in New Issue
Block a user