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),
"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
}
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.

View File

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

View File

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

View File

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

View File

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