From 412495e2f93d6a1ccb3feab876c28f6c756b70c1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 1 Mar 2022 03:40:43 +0200 Subject: [PATCH] gf --- files/helpers/const.py | 2 ++ files/routes/comments.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 6ffa8c71db..f5bf8f8ab2 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -656,6 +656,8 @@ valid_password_regex = re.compile("^.{8,100}$", flags=re.A) marsey_regex = re.compile("^(:[!#A-Za-z0-9]{1,30}?:\s*)+$", flags=re.A) +marsey_regex2 = re.compile("[a-z0-9]{1,30}", flags=re.A) + image_regex = re.compile("(^https:\/\/.*\.(png|jpg|jpeg|gif|webp|maxwidth=9999|fidelity=high)($|\s))", flags=re.I|re.M|re.A) valid_sub_regex = re.compile("^[a-zA-Z0-9_\-]{3,20}$", flags=re.A) diff --git a/files/routes/comments.py b/files/routes/comments.py index 1912f584f4..4a7bbd1c68 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -268,7 +268,7 @@ def api_comment(v): marsey = loads(body.lower()) name = marsey["name"] - if not marsey_regex.fullmatch(name): + if not marsey_regex2.fullmatch(name): return {"error": "Invalid name!"}, 403 if "author" in marsey: author_id = get_user(marsey["author"]).id