mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix BAD_PATTERN regex in deeplinking process. (#1630)
* add test payload in `test_deep_linking` to demonstrate the bug * fix the `BAD_PATTERN` regex * add changes file
This commit is contained in:
parent
a516b7f03f
commit
bbdc43b737
3 changed files with 4 additions and 1 deletions
1
CHANGES/1630.bugfix.rst
Normal file
1
CHANGES/1630.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Fix the regex pattern that finds the "bad characters" for deeplink payload.
|
||||||
|
|
@ -18,7 +18,7 @@ from aiogram.utils.payload import decode_payload, encode_payload
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from aiogram import Bot
|
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(
|
async def create_start_link(
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,14 @@ PAYLOADS = [
|
||||||
"aaBBccDDeeFF5544332211",
|
"aaBBccDDeeFF5544332211",
|
||||||
-12345678901234567890,
|
-12345678901234567890,
|
||||||
12345678901234567890,
|
12345678901234567890,
|
||||||
|
"underscore_and-dash",
|
||||||
]
|
]
|
||||||
WRONG_PAYLOADS = [
|
WRONG_PAYLOADS = [
|
||||||
"@BotFather",
|
"@BotFather",
|
||||||
"Some:special$characters#=",
|
"Some:special$characters#=",
|
||||||
"spaces spaces spaces",
|
"spaces spaces spaces",
|
||||||
1234567890123456789.0,
|
1234567890123456789.0,
|
||||||
|
"has`backtick",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue