Skip to content

Commit

Permalink
Merge pull request #1149 from rdmorganiser/project_xml_content_dispos…
Browse files Browse the repository at this point in the history
…ition

Use EXPORT_CONTENT_DISPOSITION for project xml export
  • Loading branch information
jochenklar authored Nov 19, 2024
2 parents 886e8d5 + db31e9b commit 7c51c4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rdmo/projects/exports.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re

from django.conf import settings
from django.http import HttpResponse

from rdmo.core.exports import prettify_xml
Expand Down Expand Up @@ -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

0 comments on commit 7c51c4c

Please sign in to comment.