mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 09:08:26 +01: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