mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 04:35:16 +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),
|
||||
"update_time": time.Now(),
|
||||
})
|
||||
if num == 0 {
|
||||
err = fmt.Errorf("Failed to increase repository pull count with name: %s %s", name, err.Error())
|
||||
}
|
||||
if err != nil {
|
||||
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.
|
||||
func RepositoryExists(name string) bool {
|
||||
|
@ -48,6 +48,9 @@ func GetSystemLdapConf() (models.LdapConf, error) {
|
||||
}
|
||||
|
||||
ldap, err := config.LDAP()
|
||||
if err != nil {
|
||||
return ldapConfs, err
|
||||
}
|
||||
|
||||
ldapConfs.LdapURL = ldap.URL
|
||||
ldapConfs.LdapSearchDn = ldap.SearchDN
|
||||
|
@ -164,6 +164,9 @@ func (s *standardTokenAuthorizer) generateToken(realm, service string, scopes []
|
||||
realm = s.tokenURL(realm)
|
||||
tk, err := getToken(s.client, s.credential, realm,
|
||||
service, scopes)
|
||||
if err != nil {
|
||||
return "", 0, nil, err
|
||||
}
|
||||
|
||||
if len(tk.IssuedAt) == 0 {
|
||||
return tk.Token, tk.ExpiresIn, nil, nil
|
||||
|
@ -64,6 +64,8 @@ func (pma *ProjectMemberAPI) Prepare() {
|
||||
} else {
|
||||
text += fmt.Sprintf("%d", pid)
|
||||
}
|
||||
pma.HandleBadRequest(text)
|
||||
return
|
||||
}
|
||||
project, err := pma.ProjectMgr.Get(pid)
|
||||
if err != nil {
|
||||
|
@ -70,6 +70,10 @@ func (n *NotificationHandler) Post() {
|
||||
log.Errorf("failed to get project by name %s: %v", project, err)
|
||||
return
|
||||
}
|
||||
if pro == nil {
|
||||
log.Warningf("project %s not found", project)
|
||||
continue
|
||||
}
|
||||
|
||||
go func() {
|
||||
if err := dao.AddAccessLog(models.AccessLog{
|
||||
|
Loading…
Reference in New Issue
Block a user