mirror of
https://github.com/goharbor/harbor
synced 2025-04-16 20:21:27 +00:00
Merge pull request #679 from ywk253100/master_d
bug fix: check whether project is nil befere reading its properties
This commit is contained in:
commit
361f6bd393
|
@ -121,6 +121,10 @@ func (ra *RepositoryAPI) Delete() {
|
|||
ra.CustomAbort(http.StatusInternalServerError, "")
|
||||
}
|
||||
|
||||
if project == nil {
|
||||
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("project %s not found", projectName))
|
||||
}
|
||||
|
||||
if project.Public == 0 {
|
||||
userID := ra.ValidateUser()
|
||||
if !hasProjectAdminRole(userID, project.ProjectID) {
|
||||
|
@ -270,6 +274,10 @@ func (ra *RepositoryAPI) GetManifests() {
|
|||
ra.CustomAbort(http.StatusInternalServerError, "")
|
||||
}
|
||||
|
||||
if project == nil {
|
||||
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("project %s not found", projectName))
|
||||
}
|
||||
|
||||
if project.Public == 0 {
|
||||
userID := ra.ValidateUser()
|
||||
if !checkProjectPermission(userID, project.ProjectID) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user