From d0d82e0bb7980bfeb68ad3dc3a05bb3582f41d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dachary?= Date: Thu, 2 Nov 2023 16:41:34 +0100 Subject: [PATCH] fix POST /{owner}/{repo}/comments/{id}/delete (cherry picked from commit 1b57d8493882d9d659164acd3b4a5a99c769d8ed) --- routers/web/repo/issue.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index bae1b79d0c..4e7d558deb 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -3164,6 +3164,11 @@ func DeleteComment(ctx *context.Context) { return } + if comment.Issue.RepoID != ctx.Repo.Repository.ID { + ctx.NotFound("CompareRepoID", issues_model.ErrCommentNotExist{}) + return + } + if !ctx.IsSigned || (ctx.Doer.ID != comment.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull)) { ctx.Error(http.StatusForbidden) return