diff --git a/CHANGES/1630.bugfix.rst b/CHANGES/1630.bugfix.rst new file mode 100644 index 00000000..e083dc1f --- /dev/null +++ b/CHANGES/1630.bugfix.rst @@ -0,0 +1 @@ +Fix the regex pattern that finds the "bad characters" for deeplink payload. \ No newline at end of file diff --git a/aiogram/utils/deep_linking.py b/aiogram/utils/deep_linking.py index 19cc64c6..fe2764f7 100644 --- a/aiogram/utils/deep_linking.py +++ b/aiogram/utils/deep_linking.py @@ -18,7 +18,7 @@ from aiogram.utils.payload import decode_payload, encode_payload if TYPE_CHECKING: from aiogram import Bot -BAD_PATTERN = re.compile(r"[^A-z0-9-]") +BAD_PATTERN = re.compile(r"[^a-zA-Z0-9-_]") async def create_start_link( diff --git a/tests/test_utils/test_deep_linking.py b/tests/test_utils/test_deep_linking.py index 85a6027b..c5f5259a 100644 --- a/tests/test_utils/test_deep_linking.py +++ b/tests/test_utils/test_deep_linking.py @@ -10,12 +10,14 @@ PAYLOADS = [ "aaBBccDDeeFF5544332211", -12345678901234567890, 12345678901234567890, + "underscore_and-dash", ] WRONG_PAYLOADS = [ "@BotFather", "Some:special$characters#=", "spaces spaces spaces", 1234567890123456789.0, + "has`backtick", ]