From 5803052bb76a2648271739b6709b6ca17ae27ca7 Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Sat, 2 Oct 2021 09:36:32 -0600 Subject: [PATCH] server: return proper MIME-types for webfonts --- pelican/server.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pelican/server.py b/pelican/server.py index 893cc800..7a183bce 100644 --- a/pelican/server.py +++ b/pelican/server.py @@ -43,6 +43,21 @@ def parse_arguments(): class ComplexHTTPRequestHandler(server.SimpleHTTPRequestHandler): SUFFIXES = ['.html', '/index.html', '/', ''] + extensions_map = _encodings_map_default = { + # included in Python default implementation + '.gz': 'application/gzip', + '.Z': 'application/octet-stream', + '.bz2': 'application/x-bzip2', + '.xz': 'application/x-xz', + + # web fonts + ".oft": "font/oft", + ".sfnt": "font/sfnt", + ".ttf": "font/ttf", + ".woff": "font/woff", + ".woff2": "font/woff2", + } + def translate_path(self, path): # abandon query parameters path = path.split('?', 1)[0]