1
0
Fork 0
forked from forgejo/forgejo

[GITEA] Add Upload URL to release API

- Resolves https://codeberg.org/forgejo/forgejo/issues/580
- Return a `upload_field` to any release API response, which points to
the API URL for uploading new assets.
- Adds unit test.
- Adds integration testing to verify URL is returned correctly and that
upload endpoint actually works

(cherry picked from commit 074413a2dc)
(cherry picked from commit 33feed4723)
This commit is contained in:
Gusted 2023-06-24 15:11:39 +02:00 committed by Earl Warren
parent dfdbaba3d6
commit 1ca21b95ff
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
6 changed files with 79 additions and 0 deletions

View file

@ -132,6 +132,11 @@ func (r *Release) HTMLURL() string {
return r.Repo.HTMLURL() + "/releases/tag/" + util.PathEscapeSegments(r.TagName)
}
// APIUploadURL the api url to upload assets to a release. release must have attributes loaded
func (r *Release) APIUploadURL() string {
return r.APIURL() + "/assets"
}
// Link the relative url for a release on the web UI. release must have attributes loaded
func (r *Release) Link() string {
return r.Repo.Link() + "/releases/tag/" + util.PathEscapeSegments(r.TagName)