From d9a5bcdd5401fd486df77739f560a074b259be3c Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Thu, 4 Jul 2019 17:44:25 +0000 Subject: [PATCH] backend: add webp mimetype --- mangareader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mangareader.py b/mangareader.py index 6d6f467..9f2ce5b 100755 --- a/mangareader.py +++ b/mangareader.py @@ -3,7 +3,7 @@ from backend import CalibreDB from flask import Flask, jsonify, send_from_directory, send_file, render_template, request from flask_cors import CORS from werkzeug.routing import BaseConverter -import mimetypes +from mimetypes import types_map as mimetypes import os @@ -14,6 +14,8 @@ def send_from_cwd(filename): app = Flask(__name__, static_folder='frontend/dist/static', template_folder='frontend/dist') CORS(app) +mimetypes['.webp'] = 'image/webp' + db = CalibreDB() # kind of redundant, but avoids returning 200 if page does not exist @@ -64,7 +66,7 @@ def get_volume_info(volume_id): @app.route('/api/volume//page/') def get_volume_page(volume_id, page_number): page = db.get_volume_page(volume_id, page_number) - mimetype = mimetypes.types_map[page['extension']] + mimetype = mimetypes[page['extension']] return send_file(page['data'], mimetype=mimetype)