mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-29 21:54:13 +01:00
fix #591
This commit is contained in:
parent
aa03a8fd3f
commit
82af69d9f6
@ -134,6 +134,10 @@ func (ra *RepJobAPI) Delete() {
|
|||||||
ra.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
ra.CustomAbort(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if job == nil {
|
||||||
|
ra.CustomAbort(http.StatusNotFound, fmt.Sprintf("job %d not found", ra.jobID))
|
||||||
|
}
|
||||||
|
|
||||||
if job.Status == models.JobPending || job.Status == models.JobRunning {
|
if job.Status == models.JobPending || job.Status == models.JobRunning {
|
||||||
ra.CustomAbort(http.StatusBadRequest, fmt.Sprintf("job is %s, can not be deleted", job.Status))
|
ra.CustomAbort(http.StatusBadRequest, fmt.Sprintf("job is %s, can not be deleted", job.Status))
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
@ -210,6 +211,10 @@ func (ra *RepositoryAPI) GetTags() {
|
|||||||
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