Skip to content

Changes to font MIME-types based on IANA's new (ca. 2017) "font" type. #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions images.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down