Skip to content

fix(gateway): parse MEDIA: tags with Windows paths (#28989)#29234

Closed
Jiahui-Gu wants to merge 1 commit into
NousResearch:mainfrom
Jiahui-Gu:fix/media-tag-windows-path-28989
Closed

fix(gateway): parse MEDIA: tags with Windows paths (#28989)#29234
Jiahui-Gu wants to merge 1 commit into
NousResearch:mainfrom
Jiahui-Gu:fix/media-tag-windows-path-28989

Conversation

@Jiahui-Gu

Copy link
Copy Markdown
Contributor

Summary

Fixes #28989. MEDIA: tag extraction in gateway/platforms/base.py:2162 used the path prefix pattern (?:~/|/), which only matched POSIX-style absolute / home paths. Windows paths like C:/Users/foo/img.png and C:\Users\foo\img.png did not match, so extract_media() returned empty and the raw MEDIA:C:\... text was forwarded as plain text instead of being attached as an image.

Fix

gateway/platforms/base.py: extend media_pattern path prefix to (?:~/|/|[A-Za-z]:[/\\]), covering C:/... (forward slash) and D:\... (backslash) drive-letter paths on Windows. Existing POSIX paths still match.

Test plan

  • New test_media_tag_supports_windows_forward_slash_path and test_media_tag_supports_windows_backslash_path in tests/gateway/test_platform_base.py
  • Manual regex verification on 4 cases (Windows forward / backslash / POSIX absolute / ~) all match correctly

🤖 Generated with Claude Code

@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 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix with #28991 and #24049 — all target Windows drive-letter path support in extract_media() regex. #28991 also fixes extract_local_files(); #24049 also adds GIS extensions.

@Jiahui-Gu

Copy link
Copy Markdown
Contributor Author

Closing in favor of #28991 (#28991 also fixes extract_local_files(), more complete coverage). Thanks @alt-glitch for the duplicate detection — releasing review bandwidth so reviewers can focus on the earlier PR.

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]: MEDIA: tags with Windows paths not parsed — images sent as plain text

3 participants