diff options
Diffstat (limited to 'peekaboo')
-rw-r--r-- | peekaboo/toolbox/files.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/peekaboo/toolbox/files.py b/peekaboo/toolbox/files.py index 90503ed..6fe535e 100644 --- a/peekaboo/toolbox/files.py +++ b/peekaboo/toolbox/files.py @@ -36,8 +36,10 @@ logger = logging.getLogger(__name__) def guess_mime_type_from_file_contents(file_path): """ Get type from file magic bytes. """ mt = magic.from_file(file_path, mime=True) - if mt: - return mt + if not mt: + return None + + return mt def guess_mime_type_from_filename(file_path): @@ -47,5 +49,7 @@ def guess_mime_type_from_filename(file_path): mimetypes.add_type('application/javascript', '.jse') mt = mimetypes.guess_type(file_path)[0] - if mt: - return mt + if not mt: + return None + + return mt |