feat(gateway): add document extensions to MEDIA: regex#19926
Conversation
|
Likely duplicate of #14307 (merged) — same change: extending MEDIA: regex with document extensions in gateway/platforms/base.py. The extensions added here (json, xml, md, html, js, py, sh, yaml, yml, toml) may partially overlap with what #14307 already added. Please verify which extensions are actually missing before merging. |
|
Likely duplicate of #14307 (merged) — same change: extending MEDIA: regex with document extensions in gateway/platforms/base.py. |
- Add .gpx, .kml, .geojson, .html, .htm, .js MIME types - Extend MEDIA: regex: gpx|kml|geojson|html|htm|js|py|sh|json|xml|yaml|yml|toml|md
ad5be50 to
449f2e9
Compare
|
This PR adds support for GIS and code/document extensions that are not covered by any of the similar open PRs: New MIME types (not in #24049 or #24217):
**Extended to recognize: gpx|kml|geojson|html|htm|js|py|sh|json|xml|yaml|yml|toml|md Real-world use case: I use Hermes to generate GPX files from my travels — asking it for points of interest in a city, restaurants, or landmarks, then rendering the output as .gpx with waypoints to import into map apps like HERE WeGo, Organic Maps, etc. Without these extensions in the MIME dict and the the gateway couldn't recognize and deliver these files natively. PRs #24049 (Windows drive letters + GIS extensions by another author) and #24217 (spaced paths) don't overlap with the actual MIME type additions or the full extension list in the regex. This PR provides the complete set needed for the GPS/map workflow. |
|
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. |
Description
Extend
extract_media()ingateway/platforms/base.pyto recognize document, data, GPS, and config file types so they are delivered natively as file attachments viasend_document()instead of being silently ignored.Added Extensions
gpx,kml,geojsonjson,xml,md,html,js,py,shyaml,yml,tomlWhy This Matters
The gateway already has
send_document()implemented for platforms that support it (Telegram, Discord, etc.), but the regex inextract_media()only matched image, video, and audio extensions. When the model includesMEDIA:/path/to/file.gpx, it was silently ignored — the user never received the file.This change enables:
send_document()already handles non-media typesTesting
Verified that
MEDIA:/path/to/file.gpxis now extracted from response text and delivered as a native document attachment via Telegram gateway.Checklist