Correctly parse the URL
review621003 (transplanted from f690b98c1a382fd36a43ba90c0272adaf6cba370)
This commit is contained in:
1 parent
d04815b6e0
commit
bc371869bb
1 file changed
+7
-7
+7
-7
@@ -5,7 +5,7 @@ import os
|
||||
import sys
|
||||
import socket
|
||||
import gettext
|
||||
from urlparse import urlparse
|
||||
from urlparse import urlparse, parse_qsl
|
||||
import urllib
|
||||
import gobject
|
||||
import gtk
|
||||
@@ -1403,14 +1403,14 @@ class Main(object):
|
||||
Main.get_main().refresh_ssl()
|
||||
|
||||
def _open_url(self, url):
|
||||
url = urllib.unquote(url)
|
||||
urlp = urlparse(url)
|
||||
if not urlp.scheme == 'tryton':
|
||||
return
|
||||
urlp = urlparse('http' + url[6:])
|
||||
hostname, port = (urlp.netloc.split(':', 1)
|
||||
+ [CONFIG.defaults['login.port']])[:2]
|
||||
database, path = (urlp.path[1:].split('/', 1) + [None])[:2]
|
||||
hostname, port = map(urllib.unquote,
|
||||
(urlp.netloc.split(':', 1) + [CONFIG.defaults['login.port']])[:2])
|
||||
database, path = map(urllib.unquote,
|
||||
(urlp.path[1:].split('/', 1) + [None])[:2])
|
||||
if (not path or
|
||||
hostname != rpc._HOST or
|
||||
int(port) != rpc._PORT or
|
||||
@@ -1420,8 +1420,8 @@ class Main(object):
|
||||
params = {}
|
||||
if urlp.params:
|
||||
try:
|
||||
params = dict(param.split('=', 1)
|
||||
for param in urlp.params.split('&'))
|
||||
params.update(dict(parse_qsl(urlp.params,
|
||||
strict_parsing=True)))
|
||||
except ValueError:
|
||||
return
|
||||
|
||||
|
||||
Reference in new issue
Block a user