Philipp Hörist pushed to branch master at gajim / gajim


Commits:
d53a41a1 by Philipp Hörist at 2024-06-22T17:59:47+02:00
cfix: Windows: Work around GLib bug with content type guessing

- - - - -


1 changed file:

- gajim/common/preview_helpers.py


Changes:

=====================================
gajim/common/preview_helpers.py
=====================================
@@ -8,6 +8,7 @@
 import hashlib
 import logging
 import mimetypes
+import sys
 from pathlib import Path
 from urllib.parse import ParseResult
 from urllib.parse import unquote
@@ -199,7 +200,9 @@ def guess_mime_type(file_path: Path | str,
     # The mimetypes module maps extensions to mime types
     # it does no guessing based on file content
     mime_type, _ = mimetypes.guess_type(file_path)
-    if mime_type is None:
+    if mime_type is None and not sys.platform == 'win32':
+        # Does not work on Windows see
+        # https://gitlab.gnome.org/GNOME/glib/-/issues/3399
         # Gio does also guess based on file content
         extension, _ = Gio.content_type_guess(file_path, data)
         mime_type = Gio.content_type_get_mime_type(extension)



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

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


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to