Strip ending / character when using url as function name

This commit is contained in:
shortcutme 2018-07-10 03:36:09 +02:00
parent 6c4ce03d59
commit 68eb9a37ca
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -105,7 +105,7 @@ class UiRequest(object):
# Internal functions # Internal functions
elif "/ZeroNet-Internal/" in path: elif "/ZeroNet-Internal/" in path:
path = re.sub(".*?/ZeroNet-Internal/", "/", path) path = re.sub(".*?/ZeroNet-Internal/", "/", path)
func = getattr(self, "action" + path.lstrip("/"), None) # Check if we have action+request_path function func = getattr(self, "action" + path.strip("/"), None) # Check if we have action+request_path function
if func: if func:
return func() return func()
else: else:
@ -145,7 +145,7 @@ class UiRequest(object):
if body: if body:
return body return body
else: else:
func = getattr(self, "action" + path.lstrip("/"), None) # Check if we have action+request_path function func = getattr(self, "action" + path.strip("/"), None) # Check if we have action+request_path function
if func: if func:
return func() return func()
else: else: