add some base parameter validation

This commit is contained in:
Damien Churchill 2010-03-21 10:33:02 +00:00
parent c6caae848f
commit c03f519f9a
1 changed files with 10 additions and 1 deletions

View File

@ -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])