From efcbeb3af3ce17054ed7e7341f7b01201ba09f83 Mon Sep 17 00:00:00 2001 From: zakary Date: Fri, 12 Jan 2024 15:46:24 -0600 Subject: [PATCH] fix(trakt/username): restrict to alphanumeric usernames addresses a bug that needs further investigation returning 405 when non-alphanumeric usernames are provided to trakt's api #7 --- retraktarr/config.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/retraktarr/config.py b/retraktarr/config.py index 0ae535f..1900246 100644 --- a/retraktarr/config.py +++ b/retraktarr/config.py @@ -50,6 +50,19 @@ def __init__(self, config_file): else: try: self.conf.read(config_file) + # checks for alphanumeric usernames + if ( + bool( + re.compile(r"^[a-zA-Z0-9]+$").match( + self.conf.get("Trakt", "username") + ) + ) + is False + ): + print( + "Error occurred while reading the configuration file:\nOnly alphanumeric usernames are supported currently." + ) + sys.exit(1) except configparser.Error as error: print(f"Error occurred while reading the configuration file: {error}") sys.exit(1)