Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot download source tarballs via API token authorization #29249

Closed
keeferrourke opened this issue Feb 19, 2024 · 0 comments · Fixed by #29342
Closed

Cannot download source tarballs via API token authorization #29249

keeferrourke opened this issue Feb 19, 2024 · 0 comments · Fixed by #29342
Labels
Milestone

Comments

@keeferrourke
Copy link

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

silverwind pushed a commit that referenced this issue Feb 23, 2024
Fix #29249

~~Use the `/repos/{owner}/{repo}/archive/{archive}` API to download.~~

Apply #26430 to archive download URLs.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Feb 23, 2024
Fix go-gitea#29249

~~Use the `/repos/{owner}/{repo}/archive/{archive}` API to download.~~

Apply go-gitea#26430 to archive download URLs.
6543 pushed a commit that referenced this issue Feb 23, 2024
Backport #29342 by @Zettat123

Fix #29249

~~Use the `/repos/{owner}/{repo}/archive/{archive}` API to download.~~

Apply #26430 to archive download URLs.

Co-authored-by: Zettat123 <zettat123@gmail.com>
@lunny lunny added this to the 1.21.7 milestone Feb 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants