From 9e1471c9d21cfa00d854035b496b619196391c66 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Mon, 13 Nov 2023 01:09:51 +0300 Subject: [PATCH] sanitize hashtags --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 92c410b..1ab9ac4 100644 --- a/main.py +++ b/main.py @@ -40,7 +40,7 @@ ChatFilter = F.chat.id.in_(set(map(int, os.environ['USERS'].split(',')))) def format_tags(tags: Iterable[str]): - return ' '.join(f'#{tag}' for tag in tags) or 'None' + return ' '.join(f'#{re.sub(r"[^0-9a-zA-Z_]", "_", tag)}' for tag in tags) or 'None' def recover_url(file: E621PostFile):