Skip to content

Commit

Permalink
Change: Use request URL when downloading GitHub release files
Browse files Browse the repository at this point in the history
Before the URL of the response was used. GitHub uses a lot of redirects.
Therefore the response URL contained the last redirected URL. Displaying
the originally requested URL seems to be much better at least for
release files.
  • Loading branch information
bjoernricks committed Jul 4, 2023
1 parent 93b2286 commit 361088f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pontos/github/api/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def download_release_tarball(
print(progress)
""" # noqa: E501
api = f"https://github.com/{repo}/archive/refs/tags/{tag}.tar.gz"
return download_async(self._client.stream(api))
return download_async(self._client.stream(api), url=api)

def download_release_zip(
self,
Expand Down Expand Up @@ -208,7 +208,7 @@ def download_release_zip(
print(progress)
""" # noqa: E501
api = f"https://github.com/{repo}/archive/refs/tags/{tag}.zip"
return download_async(self._client.stream(api))
return download_async(self._client.stream(api), url=api)

async def download_release_assets(
self,
Expand Down Expand Up @@ -275,7 +275,9 @@ async def download_asset(name: str, download_cm) -> Path:
if match_pattern and not Path(name).match(match_pattern):
continue

yield name, download_async(self._client.stream(asset_url))
yield name, download_async(
self._client.stream(asset_url), url=asset_url
)

async def upload_release_assets(
self,
Expand Down

0 comments on commit 361088f

Please sign in to comment.