hermes - 💡(How to fix) Fix `extract_media()` regex missing `.md` and other text-based extensions, mismatch with `extract_local_files()` [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

Commit ea49b3862 removed the |\S+ fallback from the extract_media() regex (to fix Mattermost false positives), leaving only a hardcoded extension list. This list is missing several extensions that extract_local_files() supports:

In extract_media() regex (line ~2416):

png|jpe?g|gif|webp|mp4|mov|avi|mkv|webm|ogg|opus|mp3|wav|m4a|flac|epub|pdf|zip|rar|7z|docx?|xlsx?|pptx?|txt|csv|apk|ipa

In extract_local_files() (line ~2458-2475), additionally includes:

.md, .doc, .odt, .rtf, .ods, .tsv, .json, .xml, .yaml, .yml, .ppt, .odp, .key, .tar, .gz, .tgz, .bz2, .xz, .html, .htm,
.tiff, .svg, .bmp

Fix Action

Fixed

Code Example

png|jpe?g|gif|webp|mp4|mov|avi|mkv|webm|ogg|opus|mp3|wav|m4a|flac|epub|pdf|zip|rar|7z|docx?|xlsx?|pptx?|txt|csv|apk|ipa

---

.md, .doc, .odt, .rtf, .ods, .tsv, .json, .xml, .yaml, .yml, .ppt, .odp, .key, .tar, .gz, .tgz, .bz2, .xz, .html, .htm,
.tiff, .svg, .bmp
RAW_BUFFERClick to expand / collapse

Bug Description

BasePlatformAdapter.extract_media() cannot extract .mdfiles (and several other text-based formats), whileextract_local_files()correctly recognizes them. This causes to be sent as plain text instead of a native file attachment.

Root Cause

Commit ea49b3862 removed the |\S+ fallback from the extract_media() regex (to fix Mattermost false positives), leaving only a hardcoded extension list. This list is missing several extensions that extract_local_files() supports:

In extract_media() regex (line ~2416):

png|jpe?g|gif|webp|mp4|mov|avi|mkv|webm|ogg|opus|mp3|wav|m4a|flac|epub|pdf|zip|rar|7z|docx?|xlsx?|pptx?|txt|csv|apk|ipa

In extract_local_files() (line ~2458-2475), additionally includes:

.md, .doc, .odt, .rtf, .ods, .tsv, .json, .xml, .yaml, .yml, .ppt, .odp, .key, .tar, .gz, .tgz, .bz2, .xz, .html, .htm,
.tiff, .svg, .bmp

Reproduction

  1. Use send_message tool on any platform (tested on Weixin):
    • send_message(message=" target="weixin")
  2. Expected: file delivered as native attachment
  3. Actual: literal string ` sent as text

Environment

  • Hermes Agent latest (post ea49b3862)
  • Platform: Weixin (likely affects all platforms)
  • File in allowed cache directory (~/.hermes/cache/documents/)

Suggested Fix

Sync the extract_media() regex extension list with extract_local_files(), or better yet, extract the shared extension list into a constant used by both methods.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix `extract_media()` regex missing `.md` and other text-based extensions, mismatch with `extract_local_files()` [2 pull requests]