aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/convert/convert.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/services/convert/convert.go b/services/convert/convert.go
index 9d2afdea30..17bc83653f 100644
--- a/services/convert/convert.go
+++ b/services/convert/convert.go
@@ -197,13 +197,22 @@ func ToBranchProtection(ctx context.Context, bp *git_model.ProtectedBranch, repo
// ToTag convert a git.Tag to an api.Tag
func ToTag(repo *repo_model.Repository, t *git.Tag) *api.Tag {
+ tarballURL := util.URLJoin(repo.HTMLURL(), "archive", t.Name+".tar.gz")
+ zipballURL := util.URLJoin(repo.HTMLURL(), "archive", t.Name+".zip")
+
+ // Archive URLs are "" if the download feature is disabled
+ if setting.Repository.DisableDownloadSourceArchives {
+ tarballURL = ""
+ zipballURL = ""
+ }
+
return &api.Tag{
Name: t.Name,
Message: strings.TrimSpace(t.Message),
ID: t.ID.String(),
Commit: ToCommitMeta(repo, t),
- ZipballURL: util.URLJoin(repo.HTMLURL(), "archive", t.Name+".zip"),
- TarballURL: util.URLJoin(repo.HTMLURL(), "archive", t.Name+".tar.gz"),
+ ZipballURL: zipballURL,
+ TarballURL: tarballURL,
}
}