fix POST /{owner}/{repo}/comments/{id}/delete

(cherry picked from commit 1b57d8493882d9d659164acd3b4a5a99c769d8ed)
This commit is contained in:
Loïc Dachary 2023-11-02 16:41:34 +01:00
parent d2c16d9c2d
commit 44f2592028
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

@ -3037,6 +3037,11 @@ func DeleteComment(ctx *context.Context) {
return 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)) { if !ctx.IsSigned || (ctx.Doer.ID != comment.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull)) {
ctx.Error(http.StatusForbidden) ctx.Error(http.StatusForbidden)
return return