1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-06-26 15:13:17 +00:00

Solve Chinese garbled code

This commit is contained in:
oliver ni 2023-04-23 16:38:53 +08:00
parent fe4dc1bb8f
commit 89ed352281

View File

@ -960,6 +960,9 @@ def do_download_file(book, book_format, client, data, headers):
# ToDo Check headers parameter
for element in headers:
response.headers[element[0]] = element[1]
# Solve Chinese garbled code
from urllib.parse import unquote
response.headers["Content-Disposition"] = "attachment; filename*=UTF-8''{}".format(quote(data.name))
log.info('Downloading file: {}'.format(os.path.join(filename, data.name + "." + book_format)))
return response