mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-11 02:17:42 +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, "")
|
ra.CustomAbort(http.StatusInternalServerError, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if project == nil {
|
||||||
|
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("project %s not found", projectName))
|
||||||
|
}
|
||||||
|
|
||||||
if project.Public == 0 {
|
if project.Public == 0 {
|
||||||
userID := ra.ValidateUser()
|
userID := ra.ValidateUser()
|
||||||
if !hasProjectAdminRole(userID, project.ProjectID) {
|
if !hasProjectAdminRole(userID, project.ProjectID) {
|
||||||
@ -270,6 +274,10 @@ func (ra *RepositoryAPI) GetManifests() {
|
|||||||
ra.CustomAbort(http.StatusInternalServerError, "")
|
ra.CustomAbort(http.StatusInternalServerError, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if project == nil {
|
||||||
|
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("project %s not found", projectName))
|
||||||
|
}
|
||||||
|
|
||||||
if project.Public == 0 {
|
if project.Public == 0 {
|
||||||
userID := ra.ValidateUser()
|
userID := ra.ValidateUser()
|
||||||
if !checkProjectPermission(userID, project.ProjectID) {
|
if !checkProjectPermission(userID, project.ProjectID) {
|
||||||
|
Loading…
Reference in New Issue
Block a user