changeset 612:5983d6be4f07 frontends_multi_profiles

browser side (web panel): schemes are now checked, if no scheme is given (or a not accepted one), http:// is used
author Goffi <goffi@goffi.org>
date Tue, 10 Feb 2015 19:38:28 +0100
parents 6016c74ee323
children deddd1cd8aa5
files src/browser/sat_browser/constants.py src/browser/sat_browser/panels.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/constants.py	Tue Feb 10 19:13:25 2015 +0100
+++ b/src/browser/sat_browser/constants.py	Tue Feb 10 19:38:28 2015 +0100
@@ -36,3 +36,4 @@
                      ]
 
     WEB_PANEL_DEFAULT_URL = "http://salut-a-toi.org"
+    WEB_PANEL_SCHEMES = {'http', 'https', 'ftp', 'file'}
--- a/src/browser/sat_browser/panels.py	Tue Feb 10 19:13:25 2015 +0100
+++ b/src/browser/sat_browser/panels.py	Tue Feb 10 19:38:28 2015 +0100
@@ -480,7 +480,12 @@
         self.setWidget(self._vpanel)
 
     def onUrlClick(self, sender):
-        self._frame.setUrl(self._url.getText())
+        url = self._url.getText()
+        scheme_end = url.find(':')
+        scheme = "" if scheme_end == -1 else url[:scheme_end]
+        if scheme not in C.WEB_PANEL_SCHEMES:
+            url = "http://" + url
+        self._frame.setUrl(url)
 
 
 class MainPanel(AbsolutePanel):