Cannot download source tarballs via API token authorization #12500

Closed
opened 2025-11-02 10:11:52 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @keeferrourke on GitHub (Feb 19, 2024).

Description

I'm attempting to use the Gitea API to download a source tarball for my repository.

tarball_url="$(curl -s -X GET \
  -H "${Authorization}" \
  "https://${host}/api/v1/repos/${owner}/${repo}/releases/tags/${tag}" \
  | jq '.tarball_url'
)"

wget -vO "${repo}_${tag}.tar.gz" -d --header="${Authorization}" "$tarball_url"

However, the download fails because the tarball_url redirects to the login page.

I would expect all URLs exposed in the API to work with token Authorization.

Is there another way to download the source tarball for a repo using the API? I tried to use the assets API, however it seems like source {tar,zip}balls aren't considered to be assets in a release.

Gitea Version

1.21.4

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Fedora 38

How are you running Gitea?

I'm running Gitea via the official docker container gitea/gitea:1.21.4.

Database

SQLite

Originally created by @keeferrourke on GitHub (Feb 19, 2024). ### Description I'm attempting to use the Gitea API to download a source tarball for my repository. ``` tarball_url="$(curl -s -X GET \ -H "${Authorization}" \ "https://${host}/api/v1/repos/${owner}/${repo}/releases/tags/${tag}" \ | jq '.tarball_url' )" wget -vO "${repo}_${tag}.tar.gz" -d --header="${Authorization}" "$tarball_url" ``` However, the download fails because the tarball_url redirects to the login page. I would expect all URLs exposed in the API to work with token Authorization. Is there another way to download the source tarball for a repo using the API? I tried to use the assets API, however it seems like source {tar,zip}balls aren't considered to be assets in a release. ### Gitea Version 1.21.4 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Fedora 38 ### How are you running Gitea? I'm running Gitea via the official docker container `gitea/gitea:1.21.4`. ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 10:11:52 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12500