aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo
diff options
context:
space:
mode:
authorEarl Warren <109468362+earl-warren@users.noreply.github.com>2023-08-24 12:36:10 +0200
committerGitHub <noreply@github.com>2023-08-24 10:36:10 +0000
commita9ce570298d4541bc1b5598dc080d9e4541de17b (patch)
tree41be5a2f94a0582c4d56a1ede7a7d57b820b91c8 /models/repo
parentb21b63c61ac1038a1597acee45084896f5e39a3a (diff)
downloadgitea-a9ce570298d4541bc1b5598dc080d9e4541de17b.tar.gz
gitea-a9ce570298d4541bc1b5598dc080d9e4541de17b.zip
add Upload URL to release API (#26663)
- 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 --------- Co-authored-by: Gusted <postmaster@gusted.xyz>
Diffstat (limited to 'models/repo')
-rw-r--r--models/repo/release.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/repo/release.go b/models/repo/release.go
index a00585111e..191475d541 100644
--- a/models/repo/release.go
+++ b/models/repo/release.go
@@ -133,6 +133,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)