From 3ce2fc829d37d0429e5621a02bb787025e3f5d5f Mon Sep 17 00:00:00 2001 From: Max Metz Date: Thu, 1 Aug 2024 18:34:56 +0200 Subject: [PATCH] correcting a validation issue for 'voyage' --- src/server/BreCal/validators/validation_base_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/BreCal/validators/validation_base_utils.py b/src/server/BreCal/validators/validation_base_utils.py index 1e44d17..f00bf10 100644 --- a/src/server/BreCal/validators/validation_base_utils.py +++ b/src/server/BreCal/validators/validation_base_utils.py @@ -1,7 +1,8 @@ +import typing from string import ascii_letters, digits -def check_if_string_has_special_characters(text:str): +def check_if_string_has_special_characters(text:typing.Optional[str]): """ check, whether there are any characters within the provided string, which are not found in the ascii letters or digits ascii_letters: abcd (...) and ABCD (...) @@ -11,6 +12,8 @@ def check_if_string_has_special_characters(text:str): User: https://stackoverflow.com/users/10035985/andrej-kesely returns bool """ + if text is None: + return False return bool(set(text).difference(ascii_letters + digits + ' '))