mirror of
1
Fork 0

fix GET /{owner}/{repo}/comments/{id}/attachments

(cherry picked from commit aed193ef9f5d59aed12cfd7518765d5598c7999f)
This commit is contained in:
Loïc Dachary 2023-11-12 13:00:51 +01:00
parent aceeca55da
commit 6ef671e6a6
No known key found for this signature in database
GPG Key ID: 992D23B392F9E4F2
1 changed files with 10 additions and 0 deletions

View File

@ -3448,6 +3448,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