mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
slack_regex: Update Slack regex handle multiline strings.
This prep commit modifies the Slack text regex in `slack_message_conversion.py` to use the `re.MULTILINE` flag capture formatted strings that are adjacent to newline or end of line. These kinds of strings are likely not uncommon to be generated by Slack exporter itself and our Slack message block and attachment formatters (`render_blocks` and `render_attachments`) also produces them. This also fixes Slack webhook integration's `test_message_with_complex_formatted_texts` which was previously expecting false output. Fixes part of #30827.
This commit is contained in:
@@ -183,7 +183,7 @@ def convert_markdown_syntax(text: str, pattern: str, zulip_keyword: str) -> str:
|
||||
+ match.group(6)
|
||||
)
|
||||
|
||||
return regex.sub(pattern, replace_slack_format, text, flags=re.VERBOSE)
|
||||
return regex.sub(pattern, replace_slack_format, text, flags=re.VERBOSE | re.MULTILINE)
|
||||
|
||||
|
||||
def convert_slack_workspace_mentions(text: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user