From 3f785ee06a265d58ebc03d9dfae1a048a201dd39 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Fri, 25 Oct 2019 19:38:23 +0200 Subject: [PATCH] misc: small fix or general refactoring i did not bother commenting --- pwnagotchi/ui/web.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pwnagotchi/ui/web.py b/pwnagotchi/ui/web.py index 57f63890..8a142301 100644 --- a/pwnagotchi/ui/web.py +++ b/pwnagotchi/ui/web.py @@ -168,10 +168,11 @@ class Handler(BaseHTTPRequestHandler): self._image() elif self.path.startswith('/plugins'): - plugin_from_path = re.match(r'\/plugins\/([^\/]+)(\/.*)?', self.path) - if plugin_from_path: - plugin_name = plugin_from_path.groups()[0] - right_path = plugin_from_path.groups()[1] if len(plugin_from_path.groups()) == 2 else None + matches = re.match(r'\/plugins\/([^\/]+)(\/.*)?', self.path) + if matches: + groups = matches.groups() + plugin_name = groups[0] + right_path = groups[1] if len(groups) == 2 else None plugins.one(plugin_name, 'webhook', right_path) else: