summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-16 19:35:43 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-16 19:35:43 +0100
commit358286377832c774b7721efd86d9f4128436ec8c (patch)
tree8191f4ae756bd30e7e06fa7ffcc4ff57568427be /module/web
parentcorrect utf8 conversion for urls (diff)
downloadpyload-358286377832c774b7721efd86d9f4128436ec8c.tar.xz
correct utf8 conversion for urls
Diffstat (limited to 'module/web')
-rw-r--r--module/web/api_app.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/module/web/api_app.py b/module/web/api_app.py
index 160a984df..affcdb39a 100644
--- a/module/web/api_app.py
+++ b/module/web/api_app.py
@@ -25,16 +25,16 @@ class TBaseEncoder(json.JSONEncoder):
# accepting positional arguments, as well as kwargs via post and get
-
-@route("/api/:func:args#[a-zA-Z0-9\-_/\"'\[\]%{}]*#")
-@route("/api/:func:args#[a-zA-Z0-9\-_/\"'\[\]%{}]*#", method="POST")
+# only forbidden path symbol are "?", which is used to seperate GET data and #
+@route("/api/<func><args:re:[^#?]*>")
+@route("/api/<func><args:re:[^#?]*>", method="POST")
def call_api(func, args=""):
response.headers.replace("Content-type", "application/json")
response.headers.append("Cache-Control", "no-cache, must-revalidate")
s = request.environ.get('beaker.session')
if 'session' in request.POST:
- # removes "' so it works on json strings
+ # removes "' so it works on json strings
s = s.get_by_id(remove_chars(request.POST['session'], "'\""))
if not s or not s.get("authenticated", False):
@@ -65,7 +65,7 @@ def callApi(func, *args, **kwargs):
result = getattr(PYLOAD, func)(*[literal_eval(x) for x in args],
**dict([(x, literal_eval(y)) for x, y in kwargs.iteritems()]))
- # null is invalid json response
+ # null is invalid json response
if result is None: result = True
return json.dumps(result, cls=TBaseEncoder)