mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-14 11:41:31 +01:00
handle project name is nil
This commit is contained in:
parent
4b27ef7a25
commit
7920803735
@ -100,6 +100,10 @@ func (p *ProjectAPI) Post() {
|
||||
// Head ...
|
||||
func (p *ProjectAPI) Head() {
|
||||
projectName := p.GetString("project_name")
|
||||
if len(projectName) == 0 {
|
||||
p.CustomAbort(http.StatusBadRequest, "project_name is needed")
|
||||
}
|
||||
|
||||
project, err := dao.GetProjectByName(projectName)
|
||||
if err != nil {
|
||||
log.Errorf("error occurred in GetProjectByName: %v", err)
|
||||
|
@ -250,7 +250,6 @@ func getProjects(public int, projectName string) ([]models.Project, error) {
|
||||
}
|
||||
sql += " order by name "
|
||||
var projects []models.Project
|
||||
log.Debugf("sql xxx", sql)
|
||||
if _, err := o.Raw(sql, queryParam).QueryRows(&projects); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user