Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
02798e7d by wurstsalat at 2021-12-25T12:30:48+01:00
Preview: Improve simple mime type helper

- - - - -


1 changed file:

- gajim/common/preview_helpers.py


Changes:

=====================================
gajim/common/preview_helpers.py
=====================================
@@ -417,6 +417,8 @@ def guess_simple_file_type(file_path: str,
                            data: Optional[bytes] = None
                            ) -> tuple[Gio.Icon, str]:
     mime_type = guess_mime_type(file_path, data)
+    if mime_type == 'application/octet-stream':
+        mime_type = ''
     icon = get_icon_for_mime_type(mime_type)
     if file_path.startswith('geo:'):
         return icon, _('Location')
@@ -432,6 +434,6 @@ def guess_simple_file_type(file_path: str,
 
 
 def get_icon_for_mime_type(mime_type: str) -> Gio.Icon:
-    if mime_type is None:
+    if mime_type == '':
         return Gio.Icon.new_for_string('mail-attachment')
     return Gio.content_type_get_icon(mime_type)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/02798e7da45b1df8d5ec1ce945b906049ffc8d43

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/02798e7da45b1df8d5ec1ce945b906049ffc8d43
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to