Commit 3162d799 authored by André's avatar André Committed by Philipp Hörist

Fix opening URIs from sandbox

parent 1f845aa3
......@@ -32,7 +32,6 @@ import sys
import re
import os
import subprocess
import webbrowser
import errno
import select
import base64
......@@ -62,6 +61,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 +625,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 +1539,10 @@ def open_uri(uri, account=None):
elif uri.type == URIType.MAIL:
uri = 'mailto:%s' % uri.data
webbrowser.open(uri)
Gio.AppInfo.launch_default_for_uri(uri)
elif uri.type in (URIType.WEB, URIType.GEO):
webbrowser.open(uri.data)
Gio.AppInfo.launch_default_for_uri(uri.data)
elif uri.type == URIType.AT:
app.interface.new_chat_from_jid(account, uri.data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment