fix: add .md extension to MEDIA delivery regex#33244
Conversation
The MEDIA: file delivery regex in base.py and run.py didn't include .md files, causing .md attachments to be rendered as literal text. Add "md" to the extension alternation in all three regex copies.
|
Duplicate of #29609 (preferred approach: dynamically derive extensions from SUPPORTED_DOCUMENT_TYPES). Part of saturated MEDIA regex extension cluster with 10+ competing PRs. |
|
Superseded by #34844, which consolidates this cluster. This PR widens the Closing as superseded — thanks for surfacing and helping pin down this bug; it was part of getting the full fix right. See #34844. |
Summary
Added
.mdsupport to theMEDIA:file delivery regex.Problem
The
MEDIA:prefix in gateway responses recognizes file paths by their extension..mdwas missing from the whitelist, so sendingMEDIA:/path/to/file.mdrendered the path as literal text instead of delivering the file as an attachment.Change
Added
md|to the extension alternation in all three copies of the regex pattern:gateway/platforms/base.py—extract_media()(primary delivery path)gateway/run.py—_TOOL_MEDIA_RE(history message scan)gateway/run.py—_TOOL_MEDIA_RE(tool output scan)Testing
Verified by sending
MEDIA:/tmp/dflash.mdthrough the Telegram gateway —.mdfile now delivers as a native document attachment.