From 9631ec12ed1251a6cd6c5818f6704c3ffb923718 Mon Sep 17 00:00:00 2001 From: Vasilis The Pikachu Date: Thu, 14 Nov 2024 23:20:59 +0100 Subject: [PATCH 1/2] Remove trailing slash if user suplied a trailing slash when adding a game server. So someone fed the bot ``ss14://among.us/`` causing the bot to try to visit ``http://among.us//status``. Which the game server just responded with "not found" --- gameserverstatus/gameserverstatus.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gameserverstatus/gameserverstatus.py b/gameserverstatus/gameserverstatus.py index 5a2efb6..f64babb 100644 --- a/gameserverstatus/gameserverstatus.py +++ b/gameserverstatus/gameserverstatus.py @@ -374,6 +374,10 @@ async def addserver_ss14(self, ctx: commands.Context, name: str, address: str, l `[longname]`: The "full name" of this server. """ name = name.lower() + + if address.endswith("/"): + address = address[:-1] + async with self.config.guild(ctx.guild).servers() as cur_servers: if name in cur_servers: await ctx.send("A server with that name already exists.") From 123d1e197a1b63cfbcd2e64743127f8b59a432c2 Mon Sep 17 00:00:00 2001 From: Vasilis Date: Fri, 15 Nov 2024 19:32:11 +0100 Subject: [PATCH 2/2] accept review Co-authored-by: Pieter-Jan Briers --- gameserverstatus/gameserverstatus.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gameserverstatus/gameserverstatus.py b/gameserverstatus/gameserverstatus.py index f64babb..4d7f436 100644 --- a/gameserverstatus/gameserverstatus.py +++ b/gameserverstatus/gameserverstatus.py @@ -375,8 +375,7 @@ async def addserver_ss14(self, ctx: commands.Context, name: str, address: str, l """ name = name.lower() - if address.endswith("/"): - address = address[:-1] + address = address.rstrip("/") async with self.config.guild(ctx.guild).servers() as cur_servers: if name in cur_servers: