Skip to content
Snippets Groups Projects
Commit 6c0c4b22 authored by André's avatar André
Browse files

Fix opening URIs from sandbox

parent 3898f165
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,7 @@
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment