From c03f519f9afebc6dc9fda24e7f6a59911c3c3784 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Sun, 21 Mar 2010 10:33:02 +0000 Subject: [PATCH] add some base parameter validation --- deluge/ui/web/server.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index 02ff43683..4164f343f 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -318,7 +318,6 @@ class TopLevel(resource.Resource): "js/ext-extensions/TreeGridColumns.js", "js/ext-extensions/TreeGridRenderColumn.js", "js/ext-extensions/TreeGrid.js", - #"config.js", "gettext.js", "js/deluge-all/Deluge.js", "js/deluge-all/Deluge.Formatters.js", @@ -467,6 +466,16 @@ class TopLevel(resource.Resource): else: base = component.get("DelugeWeb").base + # validate the base parameter + if not base: + base = '/' + + if base[0] != '/': + base = '/' + base + + if base[-1] != '/': + base += '/' + web_config = component.get("Web").get_config() web_config["base"] = base config = dict([(key, web_config[key]) for key in UI_CONFIG_KEYS])