diff --git a/services/convert/attachment.go b/services/convert/attachment.go index ab36a1c577856..56fdc6b9c11df 100644 --- a/services/convert/attachment.go +++ b/services/convert/attachment.go @@ -16,10 +16,6 @@ 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) } diff --git a/tests/integration/api_releases_test.go b/tests/integration/api_releases_test.go index 7f439390833e3..40ea1cac15537 100644 --- a/tests/integration/api_releases_test.go +++ b/tests/integration/api_releases_test.go @@ -14,6 +14,7 @@ import ( "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/tests" @@ -38,6 +39,8 @@ func TestAPIListReleases(t *testing.T) { case 1: assert.False(t, release.IsDraft) assert.False(t, release.IsPrerelease) + assert.Len(t, release.Attachments, 1) + assert.EqualValues(t, setting.AppURL+"api/repos/user2/repo1/releases/1/assets/9", release.Attachments[0].DownloadURL) case 4: assert.True(t, release.IsDraft) assert.False(t, release.IsPrerelease)