Commit 014d96c3 authored by Daniel Brötzmann's avatar Daniel Brötzmann

[preview] Fix mime type guessing for python <3.8

Closes #503
parent fbe2fb44
......@@ -493,11 +493,11 @@ class UrlImagePreviewPlugin(GajimPlugin):
self._update_textview(preview, pixbuf)
def _guess_mime_type(data):
mime_type, _ = mimetypes.MimeTypes().guess_type(data)
def _guess_mime_type(file_path):
mime_type, _ = mimetypes.MimeTypes().guess_type(str(file_path))
if mime_type is None:
# Try to guess MIME type by file name
mime_type, _ = Gio.content_type_guess(str(data), None)
mime_type, _ = Gio.content_type_guess(str(file_path), None)
log.debug('Guessed MIME type: %s', str(mime_type))
return mime_type
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment