mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-07 18:58:30 +02:00
Fix bookmark asset download endpoint (#1033)
This commit is contained in:
@@ -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:
|
||||||
|
Reference in New Issue
Block a user