summaryrefslogtreecommitdiffstats
path: root/routers/repo/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/repo.go')
-rw-r--r--routers/repo/repo.go25
1 files changed, 13 insertions, 12 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 6fa566e7d6..68ffc4376a 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -8,6 +8,7 @@ package repo
import (
"errors"
"fmt"
+ "net/http"
"strings"
"time"
@@ -85,7 +86,7 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
// Check ownership of organization.
if !org.IsOrganization() {
- ctx.Error(403)
+ ctx.Error(http.StatusForbidden)
return nil
}
if !ctx.User.IsAdmin {
@@ -94,7 +95,7 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
ctx.ServerError("CanCreateOrgRepo", err)
return nil
} else if !canCreate {
- ctx.Error(403)
+ ctx.Error(http.StatusForbidden)
return nil
}
} else {
@@ -149,7 +150,7 @@ func Create(ctx *context.Context) {
ctx.Data["CanCreateRepo"] = ctx.User.CanCreateRepo()
ctx.Data["MaxCreationLimit"] = ctx.User.MaxCreationLimit()
- ctx.HTML(200, tplCreate)
+ ctx.HTML(http.StatusOK, tplCreate)
}
func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) {
@@ -199,7 +200,7 @@ func CreatePost(ctx *context.Context) {
ctx.Data["ContextUser"] = ctxUser
if ctx.HasError() {
- ctx.HTML(200, tplCreate)
+ ctx.HTML(http.StatusOK, tplCreate)
return
}
@@ -281,7 +282,7 @@ func Action(ctx *context.Context) {
err = acceptOrRejectRepoTransfer(ctx, false)
case "desc": // FIXME: this is not used
if !ctx.Repo.IsOwner() {
- ctx.Error(404)
+ ctx.Error(http.StatusNotFound)
return
}
@@ -339,7 +340,7 @@ func RedirectDownload(ctx *context.Context) {
releases, err := models.GetReleasesByRepoIDAndNames(models.DefaultDBContext(), curRepo.ID, tagNames)
if err != nil {
if models.IsErrAttachmentNotExist(err) {
- ctx.Error(404)
+ ctx.Error(http.StatusNotFound)
return
}
ctx.ServerError("RedirectDownload", err)
@@ -349,7 +350,7 @@ func RedirectDownload(ctx *context.Context) {
release := releases[0]
att, err := models.GetAttachmentByReleaseIDFileName(release.ID, fileName)
if err != nil {
- ctx.Error(404)
+ ctx.Error(http.StatusNotFound)
return
}
if att != nil {
@@ -357,7 +358,7 @@ func RedirectDownload(ctx *context.Context) {
return
}
}
- ctx.Error(404)
+ ctx.Error(http.StatusNotFound)
}
// Download an archive of a repository
@@ -366,7 +367,7 @@ func Download(ctx *context.Context) {
aReq := archiver_service.DeriveRequestFrom(ctx, uri)
if aReq == nil {
- ctx.Error(404)
+ ctx.Error(http.StatusNotFound)
return
}
@@ -380,7 +381,7 @@ func Download(ctx *context.Context) {
if complete {
ctx.ServeFile(aReq.GetArchivePath(), downloadName)
} else {
- ctx.Error(404)
+ ctx.Error(http.StatusNotFound)
}
}
@@ -392,7 +393,7 @@ func InitiateDownload(ctx *context.Context) {
aReq := archiver_service.DeriveRequestFrom(ctx, uri)
if aReq == nil {
- ctx.Error(404)
+ ctx.Error(http.StatusNotFound)
return
}
@@ -402,7 +403,7 @@ func InitiateDownload(ctx *context.Context) {
complete, _ = aReq.TimedWaitForCompletion(ctx, 2*time.Second)
}
- ctx.JSON(200, map[string]interface{}{
+ ctx.JSON(http.StatusOK, map[string]interface{}{
"complete": complete,
})
}