Skip to content

Commit b14c562

Browse files
committed
Fix overly permissive regex
1 parent 36578bf commit b14c562

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def getLogger(name=None) -> ModmailLogger:
118118

119119

120120
class FileFormatter(logging.Formatter):
121-
ansi_escape = re.compile(r"\x1B\[[0-?]*[ -/]*[@-~]")
121+
ansi_escape = re.compile(r"\x1B\[[:;<=>?@]*[ -/]*[@-~]")
122122

123123
def format(self, record):
124124
record.msg = self.ansi_escape.sub("", record.msg)

core/thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ async def send(
10061006
attachments.append(attachment)
10071007

10081008
image_urls = re.findall(
1009-
r"http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+",
1009+
r"http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[.\-]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+",
10101010
message.content,
10111011
)
10121012

0 commit comments

Comments
 (0)