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


Commits:
6c0c4b22 by André Apitzsch at 2019-11-08T07:39:49Z
Fix opening URIs from sandbox

- - - - -


1 changed file:

- gajim/common/helpers.py


Changes:

=====================================
gajim/common/helpers.py
=====================================
@@ -62,6 +62,7 @@ from nbxmpp.structs import DiscoInfo
 from nbxmpp.const import Role
 from nbxmpp.protocol import JID
 from nbxmpp.protocol import InvalidJid
+from gi.repository import Gio
 from gi.repository import GLib
 import precis_i18n.codec  # pylint: disable=unused-import
 
@@ -625,11 +626,9 @@ def launch_file_manager(path_to_open):
         except Exception:
             pass
     else:
-        command = build_command('xdg-open', path_to_open)
-        try:
-            exec_command(command)
-        except Exception:
-            pass
+        if not path_to_open.startswith('file://'):
+            path_to_open = 'file://' + path_to_open
+        Gio.AppInfo.launch_default_for_uri(path_to_open)
 
 def play_sound(event):
     if not app.config.get('sounds_on'):
@@ -1541,10 +1540,16 @@ def open_uri(uri, account=None):
 
     elif uri.type == URIType.MAIL:
         uri = 'mailto:%s' % uri.data
-        webbrowser.open(uri)
+        if os.name == 'nt':
+            webbrowser.open(uri)
+        else:
+            Gio.AppInfo.launch_default_for_uri(uri)
 
     elif uri.type in (URIType.WEB, URIType.GEO):
-        webbrowser.open(uri.data)
+        if os.name == 'nt':
+            webbrowser.open(uri.data)
+        else:
+            Gio.AppInfo.launch_default_for_uri(uri.data)
 
     elif uri.type == URIType.AT:
         app.interface.new_chat_from_jid(account, uri.data)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/6c0c4b22039e988d781cd4ba994b60466154258a

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


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to