Skip to content

Commit

Permalink
Fix Content-Disposition in RDMOXMLExport
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Nov 19, 2024
1 parent ca57c58 commit 346c508
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rdmo/projects/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,17 @@ class RDMOXMLExport(Export):

def render(self):
if self.project:
content_disposition = f'filename="{self.project.title}.xml"'
content_disposition = f'attachment; filename="{self.project.title}.xml"'
serializer = ProjectExportSerializer(self.project)

else:
content_disposition = f'filename="{self.snapshot.title}.xml"'
content_disposition = f'attachment; filename="{self.snapshot.title}.xml"'
serializer = SnapshotExportSerializer(self.snapshot)

xmldata = XMLRenderer().render(serializer.data)
response = HttpResponse(prettify_xml(xmldata), content_type="application/xml")

if settings.EXPORT_CONTENT_DISPOSITION == 'attachment':
response['Content-Disposition'] = content_disposition

return response

0 comments on commit 346c508

Please sign in to comment.