1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-10 19:48:19 +00:00

For API attachments, use API URL (#25639) (#25814)

Backport #25639 by @lunny

Fix #25257

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Giteabot
2023-07-10 08:56:16 -04:00
committed by GitHub
parent b4460cf541
commit 2b79d3fd52
19 changed files with 108 additions and 67 deletions

View File

@@ -10,8 +10,8 @@ import (
api "code.gitea.io/gitea/modules/structs"
)
// ToRelease convert a repo_model.Release to api.Release
func ToRelease(ctx context.Context, r *repo_model.Release) *api.Release {
// ToAPIRelease convert a repo_model.Release to api.Release
func ToAPIRelease(ctx context.Context, repo *repo_model.Repository, r *repo_model.Release) *api.Release {
return &api.Release{
ID: r.ID,
TagName: r.TagName,
@@ -27,6 +27,6 @@ func ToRelease(ctx context.Context, r *repo_model.Release) *api.Release {
CreatedAt: r.CreatedUnix.AsTime(),
PublishedAt: r.CreatedUnix.AsTime(),
Publisher: ToUser(ctx, r.Publisher, nil),
Attachments: ToAttachments(r.Attachments),
Attachments: ToAPIAttachments(repo, r.Attachments),
}
}