fix: safer call to webhook

This commit is contained in:
Simone Margaritelli
2019-10-25 19:32:11 +02:00
parent 4aa29f1b79
commit c0252c9830
2 changed files with 14 additions and 3 deletions

View File

@ -166,8 +166,7 @@ class Handler(BaseHTTPRequestHandler):
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
if plugin_name in plugins.loaded and hasattr(plugins.loaded[plugin_name], 'on_webhook'):
plugins.loaded[plugin_name].on_webhook(self, right_path)
plugins.one(plugin_name, 'webhook', right_path)
else:
self.send_response(404)