@@ -197,13 +197,22 @@ func ToBranchProtection(ctx context.Context, bp *git_model.ProtectedBranch, repo
197
197
198
198
// ToTag convert a git.Tag to an api.Tag
199
199
func ToTag (repo * repo_model.Repository , t * git.Tag ) * api.Tag {
200
+ tarballURL := util .URLJoin (repo .HTMLURL (), "archive" , t .Name + ".tar.gz" )
201
+ zipballURL := util .URLJoin (repo .HTMLURL (), "archive" , t .Name + ".zip" )
202
+
203
+ // Archive URLs are "" if the download feature is disabled
204
+ if setting .Repository .DisableDownloadSourceArchives {
205
+ tarballURL = ""
206
+ zipballURL = ""
207
+ }
208
+
200
209
return & api.Tag {
201
210
Name : t .Name ,
202
211
Message : strings .TrimSpace (t .Message ),
203
212
ID : t .ID .String (),
204
213
Commit : ToCommitMeta (repo , t ),
205
- ZipballURL : util . URLJoin ( repo . HTMLURL (), "archive" , t . Name + ".zip" ) ,
206
- TarballURL : util . URLJoin ( repo . HTMLURL (), "archive" , t . Name + ".tar.gz" ) ,
214
+ ZipballURL : zipballURL ,
215
+ TarballURL : tarballURL ,
207
216
}
208
217
}
209
218
@@ -307,6 +316,7 @@ func ToPublicKey(apiLink string, key *asymkey_model.PublicKey) *api.PublicKey {
307
316
Title : key .Name ,
308
317
Fingerprint : key .Fingerprint ,
309
318
Created : key .CreatedUnix .AsTime (),
319
+ Updated : key .UpdatedUnix .AsTime (),
310
320
}
311
321
}
312
322
0 commit comments