Browse Source

Merge pull request #329 from tracim/fix/320/name_of_exported_pdf_file

Damien Accorsi 6 years ago
parent
commit
c41b98f3c9
1 changed files with 7 additions and 1 deletions
  1. 7 1
      tracim/tracim/controllers/page.py

+ 7 - 1
tracim/tracim/controllers/page.py View File

@@ -100,8 +100,14 @@ class PagesController(TIMRestController):
100 100
             file_path = content_api.get_one_revision_filepath(file.revision_id)
101 101
         path = preview_manager.get_pdf_preview(file_path=file_path,
102 102
                                                page=page)
103
+        file_suffix = ''
104
+        if page > -1:
105
+            file_suffix = '.page-{}'.format(page + 1)
103 106
         tg.response.headers['Content-Disposition'] = \
104
-            'attachment; filename="{}"'.format(file.file_name)
107
+            'attachment; filename="{}{}.pdf"'.format(
108
+                file.label,
109
+                file_suffix,
110
+            )
105 111
         with open(path, 'rb') as pdf:
106 112
             return pdf.read()
107 113