Commit 29f6463e authored by Ozzieisaacs's avatar Ozzieisaacs

Fix #1149 (Prevent invalid file extensions on Kindle Paperwhite download)

parent ed0bdbf3
...@@ -798,8 +798,8 @@ def get_download_link(book_id, book_format): ...@@ -798,8 +798,8 @@ def get_download_link(book_id, book_format):
file_name = get_valid_filename(file_name) file_name = get_valid_filename(file_name)
headers = Headers() headers = Headers()
headers["Content-Type"] = mimetypes.types_map.get('.' + book_format, "application/octet-stream") headers["Content-Type"] = mimetypes.types_map.get('.' + book_format, "application/octet-stream")
headers["Content-Disposition"] = "attachment; filename*=UTF-8''%s.%s" % (quote(file_name.encode('utf-8')), headers["Content-Disposition"] = "attachment; filename=%s.%s; filename*=UTF-8''%s.%s" % (
book_format) quote(file_name.encode('utf-8')), book_format, quote(file_name.encode('utf-8')), book_format)
return do_download_file(book, book_format, data, headers) return do_download_file(book, book_format, data, headers)
else: else:
abort(404) abort(404)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment