This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 3b5a3a5a28a6cdc01fb9ebe93444029c75fd4dd5 Author: Sebb <s...@apache.org> AuthorDate: Mon Jan 31 19:57:40 2022 +0000 Don't fail if there is only one path segment --- server/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/main.py b/server/main.py index f21a684..325b76a 100644 --- a/server/main.py +++ b/server/main.py @@ -134,7 +134,12 @@ class Server(plugins.server.BaseServer): # We are backwards compatible with the old Lua interface URLs body_type = "form" # Support URLs of form /api/handler/extra?query - handler = request.path.split("/")[2] + parts = request.path.split("/") + if len(parts) < 3: + return aiohttp.web.Response( + headers=headers, status=404, text="API Endpoint not found!" + ) + handler = parts[2] # handle test requests if self.stoppable and handler == 'stop': self.background_event.set()