From 92436657268659ec11bae0be6fc52b60ea082503 Mon Sep 17 00:00:00 2001 From: tmedwards Date: Sun, 8 Oct 2017 09:21:03 -0500 Subject: [PATCH] Changes to font MIME-types based on IANA's new (ca. 2017) "font" type. --- images.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/images.py b/images.py index 6b83933..8a2a036 100644 --- a/images.py +++ b/images.py @@ -15,10 +15,18 @@ def addURIPrefix(text, mimeType): elif mimeType == 'svg': mimeType += "+xml" mimeType = "image/" + mimeType - elif mimeType in 'woff|woff2': - mimeType = "application/font-" + mimeType - elif mimeType in 'ttf|otf': - mimeType = "application/font-sfnt" + elif mimeType in 'otf|ttf|woff|woff2': + # (ca. 2017) The IANA deprecated the various font subtypes of the + # "application" type in favor of the new "font" type. While the + # standards were new at that point, many browsers had long accepted + # such media types due to existing use in the wild—erroneous at + # that point or not—so they're safe to use even considering older + # browsers. + # otf : application/font-sfnt -> font/otf + # ttf : application/font-sfnt -> font/ttf + # woff : application/font-woff -> font/woff + # woff2 : application/font-woff2 -> font/woff2 + mimeType = "font/" + mimeType else: mimeType = "application/octet-stream"