Skip to content

Commit 733c4cd

Browse files
committed
Changed error codes.
1 parent 9a59699 commit 733c4cd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

routers/private/serv.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func ServCommand(ctx *context.PrivateContext) {
162162

163163
// We can shortcut at this point if the repo is a mirror
164164
if mode > models.AccessModeRead && repo.IsMirror {
165-
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
165+
ctx.JSON(http.StatusForbidden, private.ErrServCommand{
166166
Results: results,
167167
Err: fmt.Sprintf("Mirror Repository %s/%s is read-only", results.OwnerName, results.RepoName),
168168
})
@@ -174,7 +174,7 @@ func ServCommand(ctx *context.PrivateContext) {
174174
key, err := models.GetPublicKeyByID(keyID)
175175
if err != nil {
176176
if models.IsErrKeyNotExist(err) {
177-
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
177+
ctx.JSON(http.StatusNotFound, private.ErrServCommand{
178178
Results: results,
179179
Err: fmt.Sprintf("Cannot find key: %d", keyID),
180180
})
@@ -212,7 +212,7 @@ func ServCommand(ctx *context.PrivateContext) {
212212
deployKey, err = models.GetDeployKeyByRepo(key.ID, repo.ID)
213213
if err != nil {
214214
if models.IsErrDeployKeyNotExist(err) {
215-
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
215+
ctx.JSON(http.StatusNotFound, private.ErrServCommand{
216216
Results: results,
217217
Err: fmt.Sprintf("Public (Deploy) Key: %d:%s is not authorized to %s %s/%s.", key.ID, key.Name, modeString, results.OwnerName, results.RepoName),
218218
})

0 commit comments

Comments
 (0)