diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-10-10 23:33:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 15:33:56 +0000 |
commit | 5c9fbcca00caaf676abbb475815a2a3a91107f1d (patch) | |
tree | 69777abf5ad1f933c4a6485329f2d4d86a03ed3d /services/convert | |
parent | 7ff1f2527c7121447d88ea03ba8b436ed55813b9 (diff) | |
download | gitea-5c9fbcca00caaf676abbb475815a2a3a91107f1d.tar.gz gitea-5c9fbcca00caaf676abbb475815a2a3a91107f1d.zip |
Fix attachment download bug (#27486)
Diffstat (limited to 'services/convert')
-rw-r--r-- | services/convert/attachment.go | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/services/convert/attachment.go b/services/convert/attachment.go index ab36a1c577..4a8f10f7b0 100644 --- a/services/convert/attachment.go +++ b/services/convert/attachment.go @@ -4,10 +4,7 @@ package convert import ( - "strconv" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" ) @@ -16,12 +13,7 @@ func WebAssetDownloadURL(repo *repo_model.Repository, attach *repo_model.Attachm } func APIAssetDownloadURL(repo *repo_model.Repository, attach *repo_model.Attachment) string { - if attach.CustomDownloadURL != "" { - return attach.CustomDownloadURL - } - - // /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} - return setting.AppURL + "api/repos/" + repo.FullName() + "/releases/" + strconv.FormatInt(attach.ReleaseID, 10) + "/assets/" + strconv.FormatInt(attach.ID, 10) + return attach.DownloadURL() } // ToAttachment converts models.Attachment to api.Attachment for API usage |