feat(gateway): add more file extensions to MEDIA delivery regex#33454
Closed
anxkhn wants to merge 1 commit into
Closed
feat(gateway): add more file extensions to MEDIA delivery regex#33454anxkhn wants to merge 1 commit into
anxkhn wants to merge 1 commit into
Conversation
The MEDIA tag regex only recognized a narrow set of extensions (images, video, audio, pdf, zip, office docs). Files like .vcf, .html, .md, .json were silently dropped instead of being sent as attachments on Telegram and other platforms. Add 11 new extensions: vcf, ics, json, yaml, yml, toml, md, html/htm, xml, svg — across all 3 regex patterns in the gateway.
Collaborator
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. |
19 tasks
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.
What does this PR do?
The gateway's
MEDIA:<path>file delivery regex only recognized a hardcoded set of extensions (images, video, audio, pdf, zip, office docs). When the agent tried to send other file types like.vcfcontacts,.html,.md, or.jsonviaMEDIA:<path>, the tag was silently ignored — the file never reached the user on Telegram/Discord/etc.I ran into this firsthand: I asked Hermes to send me a
.vcfcontacts file over Telegram and it just... didn't show up. The text arrived but the file was dropped silently. Turns out the extension wasn't in the allowlist.This adds 11 new extensions to all 3 regex patterns that handle MEDIA tag extraction:
vcf,icsjson,yaml,yml,tomlmd,html/htm,xml,svgAll of these are file types that Telegram (and other messaging platforms) already handle natively as document attachments — we just weren't passing them through.
Related Issue
N/A — hit this while using Hermes day-to-day.
Type of Change
Changes Made
gateway/platforms/base.py— extendedmedia_patternregex in_extract_media_paths()gateway/run.py— extended_TOOL_MEDIA_REin 2 spots (history dedup scan + tool result media scan)How to Test
.vcf,.html, or.jsonfile on the hostMEDIA:/path/to/file.vcfon TelegramChecklist
Code
fix(scope):,feat(scope):, etc.)ruff checkand all checks passDocumentation & Housekeeping
Note on tests
The three regex patterns have identical structure and only differ in file extension coverage. I'm happy to add a unit test if the maintainers would find it useful — just wasn't sure if there's an existing test module for the MEDIA extraction logic I should extend vs. creating a new one.