fix: do not return archive download URLs in API if downloads are disabled (#34324)

If archive downloads are are disabled using
_DISABLE_DOWNLOAD_SOURCE_ARCHIVES_, archive links are still returned by
the API.

This PR changes the data returned, so the fields _zipball_url_ and
_tarball_url_ are omitted if archive downloads have been disabled.

Resolve #32159
This commit is contained in:
Tobias Balle-Petersen
2025-04-30 19:06:37 +02:00
repo.diff.committed_by GitHub
repo.diff.parent ba5c3f8087
repo.diff.commit e67f74efc8
repo.diff.stats_desc%!(EXTRA int=2, int=13, int=4)

repo.diff.view_file

@@ -11,8 +11,8 @@ type Tag struct {
Message string `json:"message"`
ID string `json:"id"`
Commit *CommitMeta `json:"commit"`
ZipballURL string `json:"zipball_url"`
TarballURL string `json:"tarball_url"`
ZipballURL string `json:"zipball_url,omitempty"`
TarballURL string `json:"tarball_url,omitempty"`
}
// AnnotatedTag represents an annotated tag