Fix mimetypes not loading the database from the filesystem. #38

This commit is contained in:
Michael Lazar 2020-07-17 00:01:51 -04:00
parent cfceeb111c
commit afa210db4f
1 changed files with 6 additions and 0 deletions

View File

@ -42,6 +42,12 @@ class StaticDirectoryApplication(JetforceApplication):
self.index_file = index_file self.index_file = index_file
self.mimetypes = mimetypes.MimeTypes() self.mimetypes = mimetypes.MimeTypes()
# We need to manually load all of the operating system mimetype files
# https://bugs.python.org/issue38656
for fn in mimetypes.knownfiles:
if os.path.isfile(fn):
self.mimetypes.read(fn)
self.mimetypes.add_type("text/gemini", ".gmi") self.mimetypes.add_type("text/gemini", ".gmi")
self.mimetypes.add_type("text/gemini", ".gemini") self.mimetypes.add_type("text/gemini", ".gemini")