Merge branch 'master' into dashboard3

* master:
  Add XML declaration to OPML output (sets utf-8)
  Export OPML files as .opml
This commit is contained in:
Samuel Clay 2021-05-13 19:14:59 -04:00
commit 9c8ee66a92
2 changed files with 3 additions and 3 deletions

View file

@ -67,7 +67,7 @@ class OPMLExporter(Importer):
folders = self.get_folders()
body = SubElement(root, 'body')
self.process_outline(body, folders, verbose=verbose)
return tostring(root)
return tostring(root, encoding='utf8', method='xml')
def process_outline(self, body, folders, verbose=False):
for obj in folders:

View file

@ -79,8 +79,8 @@ def opml_export(request):
exporter = OPMLExporter(user)
opml = exporter.process()
response = HttpResponse(opml, content_type='text/xml')
response['Content-Disposition'] = 'attachment; filename=NewsBlur-%s-%s' % (
response = HttpResponse(opml, content_type='text/xml; charset=utf-8')
response['Content-Disposition'] = 'attachment; filename=NewsBlur-%s-%s.opml' % (
user.username,
now.strftime('%Y-%m-%d')
)