Sort .woff, .woff2, .eot, .ttf and .otf alphabetically

This commit is contained in:
Sahil Prajapati 2020-05-19 21:05:14 +05:30
parent 621f88e926
commit 1a0e8ed111
2 changed files with 10 additions and 4 deletions

View File

@ -412,6 +412,8 @@ def _default_mime_types():
# Make sure the entry with the preferred file extension for a particular mime type
# appears before any others of the same mimetype.
types_map = _types_map_default = {
'.woff' : 'application/font-woff',
'.woff2' : 'application/font-woff2',
'.js' : 'application/javascript',
'.mjs' : 'application/javascript',
'.json' : 'application/json',
@ -436,6 +438,7 @@ def _default_mime_types():
'.m3u8' : 'application/vnd.apple.mpegurl',
'.xls' : 'application/vnd.ms-excel',
'.xlb' : 'application/vnd.ms-excel',
'.eot' : 'application/vnd.ms-font',
'.ppt' : 'application/vnd.ms-powerpoint',
'.pot' : 'application/vnd.ms-powerpoint',
'.ppa' : 'application/vnd.ms-powerpoint',
@ -446,6 +449,8 @@ def _default_mime_types():
'.cpio' : 'application/x-cpio',
'.csh' : 'application/x-csh',
'.dvi' : 'application/x-dvi',
'.otf' : 'application/x-font-opentype',
'.ttf' : 'application/x-font-ttf',
'.gtar' : 'application/x-gtar',
'.hdf' : 'application/x-hdf',
'.latex' : 'application/x-latex',
@ -543,10 +548,6 @@ def _default_mime_types():
'.webm' : 'video/webm',
'.avi' : 'video/x-msvideo',
'.movie' : 'video/x-sgi-movie',
'.woff' : 'application/font-woff',
'.woff2' : 'application/font-woff2',
'.eot' : 'application/vnd.ms-font',
'.ttf' : 'application/x-font-ttf'
}
# These are non-standard types, commonly found in the wild. They will

View File

@ -134,11 +134,16 @@ class MimeTypesTestCase(unittest.TestCase):
def test_preferred_extension(self):
def check_extensions():
self.assertEqual(mimetypes.guess_extension('application/font-woff'), '.woff')
self.assertEqual(mimetypes.guess_extension('application/font-woff2'), '.woff2')
self.assertEqual(mimetypes.guess_extension('application/octet-stream'), '.bin')
self.assertEqual(mimetypes.guess_extension('application/postscript'), '.ps')
self.assertEqual(mimetypes.guess_extension('application/vnd.apple.mpegurl'), '.m3u')
self.assertEqual(mimetypes.guess_extension('application/vnd.ms-excel'), '.xls')
self.assertEqual(mimetypes.guess_extension('application/vnd.ms-font'), '.eot')
self.assertEqual(mimetypes.guess_extension('application/vnd.ms-powerpoint'), '.ppt')
self.assertEqual(mimetypes.guess_extension('application/x-font-opentype'), '.otf')
self.assertEqual(mimetypes.guess_extension('application/x-font-ttf'), '.ttf')
self.assertEqual(mimetypes.guess_extension('application/x-texinfo'), '.texi')
self.assertEqual(mimetypes.guess_extension('application/x-troff'), '.roff')
self.assertEqual(mimetypes.guess_extension('application/xml'), '.xsl')