Fix: underscore stripping regex in gateway helpers consumes identifiers#15076
Closed
Super-Yu wants to merge 1 commit into
Closed
Fix: underscore stripping regex in gateway helpers consumes identifiers#15076Super-Yu wants to merge 1 commit into
Super-Yu wants to merge 1 commit into
Conversation
…down The gateway/platforms/helpers.py strip_markdown() function had the same greedy underscore regex bug as cli.py. Apply identical lookbehind/lookahead fixes to _RE_ITALIC_UNDER and _RE_BOLD_UNDER patterns.
d37bc4f to
3057850
Compare
19 tasks
Contributor
|
Closing as already fixed on Triage notes (high confidence): If you still see this on the latest version, please reopen with reproduction steps. (Bulk-closed during a CLI triage sweep.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gateway/platforms/helpers.pycontains the same overly-greedy Markdown underscore regex that was already fixed incli.py. TheTextBatchAggregatorclass uses_RE_ITALIC_UNDER = re.compile(r"_(.+?)_", re.DOTALL)which strips underscores from alphanumeric identifiers likesend_as_bot,user_id,my_variable.Root Cause
Lines 160-161 in
gateway/platforms/helpers.py:This is identical to the bug that was fixed in
cli.py's_strip_markdown_syntax()— but thehelpers.pycopy was missed.Fix
Replace with lookbehind/lookahead assertions that only match actual Markdown italic delimiters:
Impact
send_as_bot,user_id,my_variableare no longer corrupted when text is stripped viaTextBatchAggregator_text_still correctly strippedcli.pyType of Change
Changes Made
gateway/platforms/helpers.py: Fixed_RE_BOLD_UNDERand_RE_ITALIC_UNDERregex patterns (2 lines changed)How to Test
send_as_botoruser_idthrough any gateway platform_text_is still correctly stripped