fix exception if no mimetype was detected
add fallback to "detect" a mime-type based on the file extension in case Python's mimetype module does not recognize the mime type.