This commit is contained in:
Wenkai Yin 2017-07-10 18:17:58 +08:00
parent 6fa12cdb1e
commit 0de64ed139
5 changed files with 18 additions and 3 deletions

View File

@ -79,10 +79,13 @@ 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.

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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{