aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/file.go2
-rw-r--r--routers/api/v1/repo/git_hook.go7
2 files changed, 5 insertions, 4 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index 1ad55d225b..7c7f53a565 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -188,7 +188,7 @@ func GetRawFileOrLFS(ctx *context.APIContext) {
meta, err := git_model.GetLFSMetaObjectByOid(ctx, ctx.Repo.Repository.ID, pointer.Oid)
// If there isn't one, just serve the data directly
- if err == git_model.ErrLFSObjectNotExist {
+ if errors.Is(err, git_model.ErrLFSObjectNotExist) {
// Handle caching for the blob SHA (not the LFS object OID)
if httpcache.HandleGenericETagTimeCache(ctx.Req, ctx.Resp, `"`+blob.ID.String()+`"`, lastModified) {
return
diff --git a/routers/api/v1/repo/git_hook.go b/routers/api/v1/repo/git_hook.go
index 9b66b69068..868acf3d85 100644
--- a/routers/api/v1/repo/git_hook.go
+++ b/routers/api/v1/repo/git_hook.go
@@ -4,6 +4,7 @@
package repo
import (
+ "errors"
"net/http"
"code.gitea.io/gitea/modules/git"
@@ -82,7 +83,7 @@ func GetGitHook(ctx *context.APIContext) {
hookID := ctx.PathParam("id")
hook, err := ctx.Repo.GitRepo.GetHook(hookID)
if err != nil {
- if err == git.ErrNotValidHook {
+ if errors.Is(err, git.ErrNotValidHook) {
ctx.NotFound()
} else {
ctx.Error(http.StatusInternalServerError, "GetHook", err)
@@ -129,7 +130,7 @@ func EditGitHook(ctx *context.APIContext) {
hookID := ctx.PathParam("id")
hook, err := ctx.Repo.GitRepo.GetHook(hookID)
if err != nil {
- if err == git.ErrNotValidHook {
+ if errors.Is(err, git.ErrNotValidHook) {
ctx.NotFound()
} else {
ctx.Error(http.StatusInternalServerError, "GetHook", err)
@@ -178,7 +179,7 @@ func DeleteGitHook(ctx *context.APIContext) {
hookID := ctx.PathParam("id")
hook, err := ctx.Repo.GitRepo.GetHook(hookID)
if err != nil {
- if err == git.ErrNotValidHook {
+ if errors.Is(err, git.ErrNotValidHook) {
ctx.NotFound()
} else {
ctx.Error(http.StatusInternalServerError, "GetHook", err)