Commit 82c9ae86 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

add support for content range

parent 63f95bc5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -8,3 +8,4 @@ jama-client-CERTIC
markdown2
python-dotenv
unidecode
django-ranged-fileresponse
 No newline at end of file
+7 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ from django.db import transaction
from pathlib import Path
from shutil import rmtree
import base64
from ranged_fileresponse import RangedFileResponse


def _silent_rmdir(dir_path: str):
@@ -280,4 +281,9 @@ def force_download(
            _check_project_permission(user, file.project, "file.download_source")
    except ServiceException:
        return HttpResponse("Forbidden", status=403)
    return FileResponse(open(file.local_path(), "rb"), filename=file.original_name)
    return RangedFileResponse(
        request,
        open(file.local_path(), "rb"),
        filename=file.original_name,
        content_type=file.file_type.mime,
    )