Merge pull request #35 from puls200/hotfix/api_input_validation_20240801

correcting a validation issue for 'voyage'
This commit is contained in:
Daniel Schick 2024-08-01 21:25:28 +02:00 committed by GitHub
commit 18719f15c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,8 @@
import typing
from string import ascii_letters, digits 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 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 (...) 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 User: https://stackoverflow.com/users/10035985/andrej-kesely
returns bool returns bool
""" """
if text is None:
return False
return bool(set(text).difference(ascii_letters + digits + ' ')) return bool(set(text).difference(ascii_letters + digits + ' '))