Fix bookmark asset download endpoint (#1033)

This commit is contained in:
Sascha Ißbrücker
2025-04-03 21:16:59 +02:00
committed by GitHub
parent 648e67bd91
commit 7b098d4549

View File

@@ -3,7 +3,7 @@ import logging
import os import os
from django.conf import settings from django.conf import settings
from django.http import FileResponse, Http404 from django.http import Http404, StreamingHttpResponse
from rest_framework import viewsets, mixins, status from rest_framework import viewsets, mixins, status
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.permissions import AllowAny from rest_framework.permissions import AllowAny
@@ -196,7 +196,7 @@ class BookmarkAssetViewSet(
if asset.asset_type == BookmarkAsset.TYPE_SNAPSHOT if asset.asset_type == BookmarkAsset.TYPE_SNAPSHOT
else asset.display_name else asset.display_name
) )
response = FileResponse(file_stream, content_type=content_type) response = StreamingHttpResponse(file_stream, content_type=content_type)
response["Content-Disposition"] = f'attachment; filename="{file_name}"' response["Content-Disposition"] = f'attachment; filename="{file_name}"'
return response return response
except FileNotFoundError: except FileNotFoundError: