diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-07-10 17:31:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 09:31:19 +0000 |
commit | 0fd1672ae49a5f69fca7d90336ae75be83a21014 (patch) | |
tree | 21b651c5ae3bf4db7434ef44de1ac9b4c7865703 /services/convert/issue_comment.go | |
parent | 5489962aac6faf3260176a0f53cbb78c44c421a5 (diff) | |
download | gitea-0fd1672ae49a5f69fca7d90336ae75be83a21014.tar.gz gitea-0fd1672ae49a5f69fca7d90336ae75be83a21014.zip |
For API attachments, use API URL (#25639)
Fix #25257
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'services/convert/issue_comment.go')
-rw-r--r-- | services/convert/issue_comment.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/services/convert/issue_comment.go b/services/convert/issue_comment.go index db48faa69e..b0145c38e6 100644 --- a/services/convert/issue_comment.go +++ b/services/convert/issue_comment.go @@ -14,8 +14,8 @@ import ( "code.gitea.io/gitea/modules/util" ) -// ToComment converts a issues_model.Comment to the api.Comment format -func ToComment(ctx context.Context, c *issues_model.Comment) *api.Comment { +// ToAPIComment converts a issues_model.Comment to the api.Comment format for API usage +func ToAPIComment(ctx context.Context, repo *repo_model.Repository, c *issues_model.Comment) *api.Comment { return &api.Comment{ ID: c.ID, Poster: ToUser(ctx, c.Poster, nil), @@ -23,14 +23,14 @@ func ToComment(ctx context.Context, c *issues_model.Comment) *api.Comment { IssueURL: c.IssueURL(), PRURL: c.PRURL(), Body: c.Content, - Attachments: ToAttachments(c.Attachments), + Attachments: ToAPIAttachments(repo, c.Attachments), Created: c.CreatedUnix.AsTime(), Updated: c.UpdatedUnix.AsTime(), } } // ToTimelineComment converts a issues_model.Comment to the api.TimelineComment format -func ToTimelineComment(ctx context.Context, c *issues_model.Comment, doer *user_model.User) *api.TimelineComment { +func ToTimelineComment(ctx context.Context, repo *repo_model.Repository, c *issues_model.Comment, doer *user_model.User) *api.TimelineComment { err := c.LoadMilestone(ctx) if err != nil { log.Error("LoadMilestone: %v", err) @@ -143,7 +143,7 @@ func ToTimelineComment(ctx context.Context, c *issues_model.Comment, doer *user_ log.Error("LoadPoster: %v", err) return nil } - comment.RefComment = ToComment(ctx, com) + comment.RefComment = ToAPIComment(ctx, repo, com) } if c.Label != nil { |