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

(cherry picked from commit 385a1f337462bec34ccc389d4efe21e3b2be8465)
This commit is contained in:
Loïc Dachary 2023-11-02 17:00:30 +01:00
parent 9b123d24d5
commit f483ce7aa2
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2

View file

@ -3098,6 +3098,11 @@ func UpdateCommentContent(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