From 6a4bc9de47a92781fc06a0fe54da3c998d557af8 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 22 Sep 2023 20:06:13 +0300 Subject: [PATCH] fix 500 error when replacing "gAmer" --- files/helpers/slurs_and_profanities.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/helpers/slurs_and_profanities.py b/files/helpers/slurs_and_profanities.py index eb121f9da..3422502ae 100644 --- a/files/helpers/slurs_and_profanities.py +++ b/files/helpers/slurs_and_profanities.py @@ -120,8 +120,6 @@ for k, val in SLURS.items(): if ')' in newkey: newkey = newkey.split(')')[1] SLURS_FOR_REPLACING[newkey] = val - SLURS_FOR_REPLACING[newkey.title()] = val.title() - SLURS_FOR_REPLACING[newkey.upper()] = val.upper() PROFANITIES_FOR_REPLACING = {} for k, val in PROFANITIES.items(): @@ -129,8 +127,6 @@ for k, val in PROFANITIES.items(): if ')' in newkey: newkey = newkey.split(')')[1] PROFANITIES_FOR_REPLACING[newkey] = val - PROFANITIES_FOR_REPLACING[newkey.title()] = val.title() - PROFANITIES_FOR_REPLACING[newkey.upper()] = val.upper() @@ -140,7 +136,11 @@ def sub_matcher(match, X_FOR_REPLACING): if match_str.startswith('<'): return match_str else: - repl = X_FOR_REPLACING[match_str] + repl = X_FOR_REPLACING[match_str.lower()] + if match_str.isupper(): + return repl.upper() + if match_str.istitle(): + return repl.title() return repl def sub_matcher_slurs(match):