Skip to content

fix(gateway): add re.IGNORECASE to MEDIA tag regex patterns#30535

Closed
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/media-tag-uppercase-extension
Closed

fix(gateway): add re.IGNORECASE to MEDIA tag regex patterns#30535
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/media-tag-uppercase-extension

Conversation

@ygd58

@ygd58 ygd58 commented May 22, 2026

Copy link
Copy Markdown
Contributor

Problem

MEDIA: tags with uppercase extensions (.JPG .PNG .MP4) silently dropped — empty message to user (issue #30526).

Fix

  1. base.py extract_media(): re.IGNORECASE on media_pattern
  2. base.py text strip: flags=re.IGNORECASE
  3. stream_consumer.py _MEDIA_RE: re.IGNORECASE

Fixes #30526

MEDIA: tags with uppercase file extensions (.JPG, .PNG, .MP4 etc.)
were silently dropped — extract_media() only matched lowercase
extensions. The raw MEDIA: text was then stripped by downstream
cleanup, leaving the user with an empty message (issue NousResearch#30526).

Three fixes:
1. base.py extract_media(): add re.IGNORECASE to media_pattern
2. base.py text_content strip: add flags=re.IGNORECASE to re.sub()
3. stream_consumer.py _MEDIA_RE: add re.IGNORECASE

companion extract_local_files() already used re.IGNORECASE correctly.

Fixes NousResearch#30526
@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 22, 2026
@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.

[Bug]: Uppercase extensions in MEDIA: tags produce empty messages

3 participants