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

Support mirror CDNs for chunked package list index download #1064

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion django/thunderstore/repository/api/v1/views/listing_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from rest_framework.views import APIView

from thunderstore.community.models import Community
from thunderstore.core.utils import replace_cdn
from thunderstore.repository.models import APIV1ChunkedPackageCache


Expand All @@ -28,6 +29,8 @@
cache = APIV1ChunkedPackageCache.get_latest_for_community(community)

if cache:
return redirect(request.build_absolute_uri(cache.index.data_url))
url = request.build_absolute_uri(cache.index.data_url)
url = replace_cdn(url, request.query_params.get("cdn"))
return redirect(url)

Check warning on line 34 in django/thunderstore/repository/api/v1/views/listing_index.py

View check run for this annotation

Codecov / codecov/patch

django/thunderstore/repository/api/v1/views/listing_index.py#L32-L34

Added lines #L32 - L34 were not covered by tests

return Response({"error": "No cache available"}, status=503)
Loading