fix(gateway): add .md to MEDIA attachment extension whitelist#33127
Closed
potatogim wants to merge 1 commit into
Closed
fix(gateway): add .md to MEDIA attachment extension whitelist#33127potatogim wants to merge 1 commit into
potatogim wants to merge 1 commit into
Conversation
The MEDIA: path extraction regex in gateway/run.py (2 locations) and gateway/platforms/base.py (1 location) was missing the "md" extension, causing Markdown files referenced via MEDIA:<path>.md tags to be silently ignored instead of being sent as document attachments. This commit adds "md" alongside the existing "txt" and "csv" text formats. Signed-off-by: Jihyeon Gim <potatogim@gluesys.com>
Collaborator
14 tasks
Contributor
|
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. |
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
The
MEDIA:<path>tag extraction regex silently drops.mdfiles. When an agent (or skill) emitsMEDIA:/path/to/file.md, the gateway never routes it tosend_document()— the path is stripped from the response and the file is never delivered to the user.This affects all platform adapters (Telegram, Discord, Slack, etc.) since the filtering happens in the shared gateway layer.
Root Cause
Three locations define the allowed file-extension regex:
gateway/run.pygateway/run.pygateway/platforms/base.pyAll three include
txtandcsvas plain-text formats but omitmd. This appears to be an oversight from commitea49b38which tightened the regex — the existing extension list was copied without adding Markdown.Fix
Add
mdalongsidetxtandcsvin all three regex patterns.Diff
3 insertions, 3 deletions — no behavioral change for any other format.
Testing
MEDIA:/tmp/test.mdnow triggerssend_document()on Telegram./scripts/run_tests.shpasses (no tests depend on the extension list being exclusive)Checklist
CONTRIBUTING.mddocument