From 85a050fca70446ea7a9e10266bbe083d5d8b63ea Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 22 Mar 2017 13:20:29 -0400 Subject: issue: fix redirect to random issue if index does not exist (#4315) --- routers/api/v1/repo/issue.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'routers/api/v1/repo/issue.go') diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index 97b058a9..ffb52b9c 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -64,7 +64,7 @@ func ListIssues(ctx *context.APIContext) { func GetIssue(ctx *context.APIContext) { issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { - if models.IsErrIssueNotExist(err) { + if errors.IsIssueNotExist(err) { ctx.Status(404) } else { ctx.Error(500, "GetIssueByIndex", err) @@ -126,7 +126,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) { func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { - if models.IsErrIssueNotExist(err) { + if errors.IsIssueNotExist(err) { ctx.Status(404) } else { ctx.Error(500, "GetIssueByIndex", err) -- cgit v1.2.3