Skip to content

Commit

Permalink
Merge pull request #1064 from thunderstore-io/chunky-pt4
Browse files Browse the repository at this point in the history
Support mirror CDNs for chunked package list index download
  • Loading branch information
MythicManiac authored Oct 1, 2024
2 parents 23f4db9 + e22daf1 commit 2c6ab97
Showing 1 changed file with 4 additions and 1 deletion.
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 @@ def get(self, request: Request, community_identifier: str):
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)

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

0 comments on commit 2c6ab97

Please sign in to comment.