diff --git a/django/thunderstore/repository/api/v1/views/listing_index.py b/django/thunderstore/repository/api/v1/views/listing_index.py index c9ff535b1..159dfa7a4 100644 --- a/django/thunderstore/repository/api/v1/views/listing_index.py +++ b/django/thunderstore/repository/api/v1/views/listing_index.py @@ -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 @@ -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)