mirror of
https://github.com/goharbor/harbor
synced 2025-04-16 12:29:19 +00:00
bug fix: check whether project is nil befere reading its properties
This commit is contained in:
parent
6fe9167e4b
commit
98e399c8fe
|
@ -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