From 48bcb1937eea9275bdb95d0842b5fb3ac3915907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dachary?= Date: Sun, 12 Nov 2023 13:00:51 +0100 Subject: [PATCH] fix GET /{owner}/{repo}/comments/{id}/attachments (cherry picked from commit aed193ef9f5d59aed12cfd7518765d5598c7999f) --- routers/web/repo/issue.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index ece290bf30..f9ec2a3604 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -3321,6 +3321,16 @@ func GetCommentAttachments(ctx *context.Context) { return } + if err := comment.LoadIssue(ctx); err != nil { + ctx.NotFoundOrServerError("LoadIssue", issues_model.IsErrIssueNotExist, err) + return + } + + if comment.Issue.RepoID != ctx.Repo.Repository.ID { + ctx.NotFound("CompareRepoID", issues_model.ErrCommentNotExist{}) + return + } + if !comment.Type.HasAttachmentSupport() { ctx.ServerError("GetCommentAttachments", fmt.Errorf("comment type %v does not support attachments", comment.Type)) return