Font mime types according to mozilla documentation

main
Bob Mottram 2020-05-26 22:52:36 +01:00
parent b6dc900305
commit d2f7a4e210
2 changed files with 8 additions and 8 deletions

View File

@ -681,10 +681,10 @@ def saveFontInFormPOST(fontBytes, debug: bool,
# directly search the binary array for the beginning # directly search the binary array for the beginning
# of a font file # of a font file
extensionList = { extensionList = {
'wOFF': 'application/font-woff', 'wOFF': 'font/woff',
'wOF2': 'application/font-woff2', 'wOF2': 'font/woff2',
'ttf': 'application/x-font-truetype', 'ttf': 'font/ttf',
'OTTO': 'application/x-font-opentype' 'OTTO': 'font/otf'
} }
detectedExtension = None detectedExtension = None
for extension, contentType in extensionList.items(): for extension, contentType in extensionList.items():

View File

@ -1112,13 +1112,13 @@ class PubServer(BaseHTTPRequestHandler):
fontStr.endswith('.woff') or \ fontStr.endswith('.woff') or \
fontStr.endswith('.woff2'): fontStr.endswith('.woff2'):
if fontStr.endswith('.otf'): if fontStr.endswith('.otf'):
fontType = 'application/x-font-opentype' fontType = 'font/otf'
elif fontStr.endswith('.ttf'): elif fontStr.endswith('.ttf'):
fontType = 'application/x-font-truetype' fontType = 'font/ttf'
elif fontStr.endswith('.woff'): elif fontStr.endswith('.woff'):
fontType = 'application/font-woff' fontType = 'font/woff'
else: else:
fontType = 'application/font-woff2' fontType = 'font/woff2'
fontFilename = \ fontFilename = \
self.server.baseDir + '/fonts/' + fontStr self.server.baseDir + '/fonts/' + fontStr
if self._etag_exists(fontFilename): if self._etag_exists(fontFilename):