We don't need to know about the `ImportError` every time we guess a mime
type. Because an `ImportError` is also raised if `python-magic` is
installed but `libmagic1` is not present, we can handle this at the
beginning of the file.
This fixes a bug that appears if the document is built on a system
without libmagic1. The python library python-magic uses it to guess the
mime type. We treat files with unknown mime type as `octet-stream`,
which causes them to be downloaded rather than displayed in the main
iframe. This results in lots of popups when opening the resulting HTML
file in a browser.
In this commit we add a fallback to the built-in library `mimetypes`
which gueses the mime type from the filename alone. This should work in
most cases but could still fail.
Close#2.