Skip to content

Commit

Permalink
Use EXPORT_CONTENT_DISPOSITION for project xml export
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Nov 14, 2024
1 parent 886e8d5 commit db31e9b
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 db31e9b

Please sign in to comment.