Skip to content

Commit

Permalink
Changed error codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
KN4CK3R committed Jun 11, 2021
1 parent 9a59699 commit 733c4cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions routers/private/serv.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func ServCommand(ctx *context.PrivateContext) {

// We can shortcut at this point if the repo is a mirror
if mode > models.AccessModeRead && repo.IsMirror {
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
ctx.JSON(http.StatusForbidden, private.ErrServCommand{
Results: results,
Err: fmt.Sprintf("Mirror Repository %s/%s is read-only", results.OwnerName, results.RepoName),
})
Expand All @@ -174,7 +174,7 @@ func ServCommand(ctx *context.PrivateContext) {
key, err := models.GetPublicKeyByID(keyID)
if err != nil {
if models.IsErrKeyNotExist(err) {
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
ctx.JSON(http.StatusNotFound, private.ErrServCommand{
Results: results,
Err: fmt.Sprintf("Cannot find key: %d", keyID),
})
Expand Down Expand Up @@ -212,7 +212,7 @@ func ServCommand(ctx *context.PrivateContext) {
deployKey, err = models.GetDeployKeyByRepo(key.ID, repo.ID)
if err != nil {
if models.IsErrDeployKeyNotExist(err) {
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
ctx.JSON(http.StatusNotFound, private.ErrServCommand{
Results: results,
Err: fmt.Sprintf("Public (Deploy) Key: %d:%s is not authorized to %s %s/%s.", key.ID, key.Name, modeString, results.OwnerName, results.RepoName),
})
Expand Down

0 comments on commit 733c4cd

Please sign in to comment.