Skip to content

fix(gateway): support markdown files in MEDIA tags#34016

Closed
newfur wants to merge 1 commit into
NousResearch:mainfrom
newfur:fix/media-md-whitelist
Closed

fix(gateway): support markdown files in MEDIA tags#34016
newfur wants to merge 1 commit into
NousResearch:mainfrom
newfur:fix/media-md-whitelist

Conversation

@newfur

@newfur newfur commented May 28, 2026

Copy link
Copy Markdown

Summary

  • add .md to the MEDIA: extraction whitelist
  • add a regression test covering MEDIA:/.../*.md extraction

Why

extract_local_files() already treats .md as a deliverable document attachment, but extract_media() omitted it from the explicit MEDIA: regex whitelist. This caused MEDIA:/path/file.md to render as literal text instead of uploading the file on messaging platforms like Telegram.

Testing

  • python3 -m pytest tests/gateway/test_send_image_file.py -q -o addopts=''
  • python3 -m pytest tests/gateway/test_send_image_file.py tests/agent/test_prompt_builder.py -q -o addopts=''

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #29609 (preferred dynamic derivation from SUPPORTED_DOCUMENT_TYPES). Part of a saturated cluster of 7+ PRs adding .md to the MEDIA regex whitelist — see also #30106, #33089, #33206, #32535, #33269.

@teknium1

Copy link
Copy Markdown
Contributor

Superseded by #34844, which consolidates this cluster.

This PR widens the extract_media extension allowlist, which is the right direction — but on its own it leaves the unconditional MEDIA:\s*\S+ strip in place, so a MEDIA: tag with any extension still outside the (now wider) list keeps getting deleted from the body before extract_local_files can pick up the bare path. #34844 fixes both halves: it unifies the two extractors onto a single shared extension set (MEDIA_DELIVERY_EXTS) AND replaces the loose strip with an extension-anchored one, so an unknown-extension path survives in the text instead of vanishing.

Closing as superseded — thanks for surfacing and helping pin down this bug; it was part of getting the full fix right. See #34844.

@teknium1 teknium1 closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants