aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/pull.go2
-rw-r--r--routers/web/repo/pull.go2
-rw-r--r--routers/web/repo/view.go3
-rw-r--r--routers/web/user/home.go2
-rw-r--r--routers/web/user/profile.go2
5 files changed, 6 insertions, 5 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index de67057fdd..7eb4a8b8a2 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -766,7 +766,7 @@ func EditPullRequest(ctx *context.APIContext) {
// update allow edits
if form.AllowMaintainerEdit != nil {
if err := pull_service.SetAllowEdits(ctx, ctx.Doer, pr, *form.AllowMaintainerEdit); err != nil {
- if errors.Is(pull_service.ErrUserHasNoPermissionForAction, err) {
+ if errors.Is(err, pull_service.ErrUserHasNoPermissionForAction) {
ctx.Error(http.StatusForbidden, "SetAllowEdits", fmt.Sprintf("SetAllowEdits: %s", err))
return
}
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index e001e872aa..7187a35e0e 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -1625,7 +1625,7 @@ func SetAllowEdits(ctx *context.Context) {
}
if err := pull_service.SetAllowEdits(ctx, ctx.Doer, pr, form.AllowMaintainerEdit); err != nil {
- if errors.Is(pull_service.ErrUserHasNoPermissionForAction, err) {
+ if errors.Is(err, pull_service.ErrUserHasNoPermissionForAction) {
ctx.Error(http.StatusForbidden)
return
}
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 5e67386457..12d202e4a0 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -8,6 +8,7 @@ import (
"bytes"
gocontext "context"
"encoding/base64"
+ "errors"
"fmt"
"html/template"
"image"
@@ -739,7 +740,7 @@ func checkHomeCodeViewable(ctx *context.Context) {
}
}
- ctx.NotFound("Home", fmt.Errorf(ctx.Locale.TrString("units.error.no_unit_allowed_repo")))
+ ctx.NotFound("Home", errors.New(ctx.Locale.TrString("units.error.no_unit_allowed_repo")))
}
func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
diff --git a/routers/web/user/home.go b/routers/web/user/home.go
index 2ecc2cc8d1..2b16142f6d 100644
--- a/routers/web/user/home.go
+++ b/routers/web/user/home.go
@@ -730,7 +730,7 @@ func UsernameSubRoute(ctx *context.Context) {
// check view permissions
if !user_model.IsUserVisibleToViewer(ctx, ctx.ContextUser, ctx.Doer) {
- ctx.NotFound("user", fmt.Errorf(ctx.ContextUser.Name))
+ ctx.NotFound("user", fmt.Errorf("%s", ctx.ContextUser.Name))
return false
}
return true
diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go
index 5748ce45ab..d0abf603c3 100644
--- a/routers/web/user/profile.go
+++ b/routers/web/user/profile.go
@@ -54,7 +54,7 @@ func OwnerProfile(ctx *context.Context) {
func userProfile(ctx *context.Context) {
// check view permissions
if !user_model.IsUserVisibleToViewer(ctx, ctx.ContextUser, ctx.Doer) {
- ctx.NotFound("user", fmt.Errorf(ctx.ContextUser.Name))
+ ctx.NotFound("user", fmt.Errorf("%s", ctx.ContextUser.Name))
return
}