From 7d8fde277ffc95a678c56750f750f6ecd8940c74 Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Mon, 16 Sep 2024 10:54:19 +0200 Subject: [PATCH] Use EXPORT_CONTENT_DISPOSITION for project xml export --- rdmo/projects/exports.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rdmo/projects/exports.py b/rdmo/projects/exports.py index 141d307050..f02450fd89 100644 --- a/rdmo/projects/exports.py +++ b/rdmo/projects/exports.py @@ -1,5 +1,6 @@ import re +from django.conf import settings from django.http import HttpResponse from rdmo.core.exports import prettify_xml @@ -157,5 +158,8 @@ def render(self): serializer = ExportSerializer(self.project) xmldata = XMLRenderer().render(serializer.data) response = HttpResponse(prettify_xml(xmldata), content_type="application/xml") - response['Content-Disposition'] = f'filename="{self.project.title}.xml"' + + if settings.EXPORT_CONTENT_DISPOSITION == 'attachment': + response['Content-Disposition'] = f'attachment; filename="{self.project.title}.xml"' + return response