From 33ef6732caecbd9f9d69a747beb35fa60a6ec335 Mon Sep 17 00:00:00 2001 From: wlinator Date: Sat, 3 Aug 2024 14:55:18 -0400 Subject: [PATCH] chore: Update image URL validation in boost module configuration commands --- lib/constants.py | 1 + modules/config/c_boost.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/constants.py b/lib/constants.py index 7de9504..dee2461 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -38,6 +38,7 @@ class Constants: # config CONFIG_GUIDE_URL = "https://wiki.wlinator.org/serverconfig" + ALLOWED_IMAGE_EXTENSIONS = (".jpg", ".png") # emotes EMOTES_GUILD_ID = 1038051105642401812 diff --git a/modules/config/c_boost.py b/modules/config/c_boost.py index 4f1000a..5d6fa06 100644 --- a/modules/config/c_boost.py +++ b/modules/config/c_boost.py @@ -72,7 +72,7 @@ async def set_boost_image(ctx, image_url: str | None): guild_config.boost_image_url = None guild_config.push() image_url = None - elif not image_url.endswith((".jpg", ".png")): + elif not image_url.endswith(CONST.ALLOWED_IMAGE_EXTENSIONS): raise LumiException(CONST.STRINGS["error_boost_image_url_invalid"]) elif not image_url.startswith(("http://", "https://")): raise LumiException(CONST.STRINGS["error_image_url_invalid"])