From 6855deceefecbc38292a7087e9688093fecb7b54 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Oct 2017 20:48:01 +0200 Subject: [PATCH] added corresponding content-type for a downloaded book, otherwise default text/html is used --- cps/web.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index b9f279c6..ef44328d 100755 --- a/cps/web.py +++ b/cps/web.py @@ -874,7 +874,11 @@ def get_opds_download_link(book_id, book_format): file_name = helper.get_valid_filename(file_name) headers = Headers() headers["Content-Disposition"] = "attachment; filename*=UTF-8''%s.%s" % (quote(file_name.encode('utf8')), book_format) - app.logger.info(time.time()-startTime) + try: + headers["Content-Type"] = mimetypes.types_map['.' + book_format] + except KeyError: + headers["Content-Type"] = "application/octet-stream" + app.logger.info(time.time() - startTime) startTime = time.time() if config.config_use_google_drive: app.logger.info(time.time() - startTime)