mirror of
https://github.com/craigerl/aprsd.git
synced 2025-03-06 19:38:42 -05:00
Fix for filtering curse words
This patch adds a fix for filtering out curse words. This adds a flag to the regex to ignore case!
This commit is contained in:
parent
873fc06608
commit
f400c6004e
@ -171,7 +171,10 @@ class Packet:
|
||||
|
||||
message = msg[:67]
|
||||
# We all miss George Carlin
|
||||
return re.sub("fuck|shit|cunt|piss|cock|bitch", "****", message)
|
||||
return re.sub(
|
||||
"fuck|shit|cunt|piss|cock|bitch", "****",
|
||||
message, flags=re.IGNORECASE,
|
||||
)
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Show the raw version of the packet"""
|
||||
|
@ -272,8 +272,8 @@ class TestPacketBase(unittest.TestCase):
|
||||
|
||||
# test with bad words
|
||||
# Currently fails with mixed case
|
||||
message = "My cunt piss fuck text"
|
||||
exp_msg = "My **** **** **** text"
|
||||
message = "My cunt piss fuck shIt text"
|
||||
exp_msg = "My **** **** **** **** text"
|
||||
msgno = "ABX"
|
||||
packet = packets.MessagePacket(
|
||||
from_call=fake.FAKE_FROM_CALLSIGN,
|
||||
|
Loading…
Reference in New Issue
Block a user