From d7f4050ae87b686ba57c575fb813e6264cce3873 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 4 Oct 2018 17:37:03 +0100 Subject: Strip empty /path/arguments in modulse/rest_api.py --- modules/rest_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/rest_api.py b/modules/rest_api.py index 2f39da78..dfdb0746 100644 --- a/modules/rest_api.py +++ b/modules/rest_api.py @@ -23,8 +23,10 @@ class Handler(http.server.BaseHTTPRequestHandler): if parsed.path.startswith("/api/"): _, _, endpoint = parsed.path[1:].partition("/") endpoint, _, args = endpoint.partition("/") + args = list(filter(None, args.split("/"))) + response = _events.on("api").on(endpoint).call_for_result( - params=get_params, path=args.split("/")) + params=get_params, path=args) if response: response = json.dumps(response, sort_keys=True, -- cgit v1.3.1-10-gc9f91