Skip to content

Commit 89e4e41

Browse files
committed
fix: Edge case fixes - double-backtick prevention, label type safety
1 parent 256124c commit 89e4e41

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

scripts/issue_bot/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ def act():
240240
is_pr = result.get("is_pr", False)
241241
title = result.get("title", "")
242242
html_url = result.get("html_url", "")
243-
labels = [l for l in result.get("labels", []) if l in cfg.allowed_labels]
243+
raw_labels = result.get("labels", [])
244+
if not isinstance(raw_labels, list):
245+
raw_labels = []
246+
labels = [l for l in raw_labels if isinstance(l, str) and l in cfg.allowed_labels]
244247
response = result.get("response", "")
245248
prompt_id = result.get("prompt_id", "unknown")
246249
model_id = result.get("model_id", "unknown")

scripts/issue_bot/sanitizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ def _fix_accidental_issue_refs(text):
3333
if line.strip().startswith("```"):
3434
in_code_block = not in_code_block
3535
if not in_code_block:
36-
line = re.sub(r'#(\d+)(?!\w)', r'`#\1`', line)
36+
line = re.sub(r'(?<!`)#(\d+)(?!\w)(?!`)', r'`#\1`', line)
3737
fixed.append(line)
3838
return "\n".join(fixed)

0 commit comments

Comments
 (0)