소스 검색

Escape regexp in message extraction

SillyLossy 3 년 전
부모
커밋
ded890c378
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      server.py

+ 2 - 2
server.py

@@ -559,8 +559,8 @@ def extract_message_from_reply(question, reply, current, other, check, extension
     next_character_found = False
     substring_found = False
 
-    previous_idx = [m.start() for m in re.finditer(f"(^|\n){current}:", question)]
-    idx = [m.start() for m in re.finditer(f"(^|\n){current}:", reply)]
+    previous_idx = [m.start() for m in re.finditer(f"(^|\n){re.escape(current)}:", question)]
+    idx = [m.start() for m in re.finditer(f"(^|\n){re.escape(current)}:", reply)]
     idx = idx[len(previous_idx)-1]
 
     if extensions: