Skip to content

Cannot download source tarballs via API token authorization #29249

@keeferrourke

Description

@keeferrourke

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions