refac: tighten details and image patterns in background task message cleanup (#30394)

The patterns that remove details blocks and inline images from task messages now stop at the next details tag, bracket or parenthesis.
This commit is contained in:
Classic298 2026-09-24 05:55:07 +02:00 • committed by GitHub
parent f7294161fa
commit 14c5b65704
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3865,7 +3865,7 @@ async def background_tasks_handler(ctx):
if isinstance(content, str):
content = re.sub(
r'<details\b[^>]*>.*?<\/details>|!\[.*?\]\(.*?\)',
r'<details\b[^<>]*>(?:(?!<details\b).)*?<\/details>|!\[[^\[\]]*\]\([^()]*\)',
'',
content,
flags=re.S | re.I,