From 5cc6361e31afe5c9506a6a591207324122a8aa5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Dachary?= <loic@dachary.org>
Date: Thu, 2 Nov 2023 17:00:30 +0100
Subject: [PATCH] fix POST /{owner}/{repo}/comments/{id}

(cherry picked from commit 385a1f337462bec34ccc389d4efe21e3b2be8465)
---
 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 9f78cb8e0a..c58e1f7a79 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -2971,6 +2971,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