fix(gateway): preserve spaced MEDIA paths - #24217
Conversation
liuhao1024
left a comment
There was a problem hiding this comment.
The extension list _MEDIA_EXTENSIONS_RE is duplicated verbatim in 4 places: gateway/platforms/base.py, gateway/stream_consumer.py, mcp_serve.py, and (partially) ui-tui/src/components/markdown.tsx. If someone adds a new extension, they'd need to find and update all four copies — an easy miss.
Since base.py already defines it as a class constant on BasePlatformAdapter, consider importing it from there in the other Python files:
# stream_consumer.py / mcp_serve.py
from gateway.platforms.base import BasePlatformAdapter
_MEDIA_EXTENSIONS_RE = BasePlatformAdapter._MEDIA_EXTENSIONS_REFor the TypeScript side, a shared MEDIA_EXTENSIONS array or a comment cross-referencing the Python source would help keep them in sync.
|
I rechecked this against current
|
Addressed in 663120ff5.
Verified with:
|
|
Follow-up commit pushed for the extension-list deduplication feedback. This is ready for another look when convenient. |
|
Verified
The cross-language comment pattern is the right tradeoff. Future maintainers updating the Python regex will see the TUI comment when they grep for the extension list. Approving on the follow-up. 🎻 |
|
Thanks for rechecking and validating the follow-up. I’ll leave the PR unchanged unless maintainers spot anything else. |
663120f to
9d12f80
Compare
|
Rebased on latest Local verification:
(Still seeing no CI statuses reported on the PR head; may need maintainer Actions approval for fork PRs.) |
9d12f80 to
34c4512
Compare
34c4512 to
40040c2
Compare
Related: this PR is a superset unifying the spaced/Windows/GIS MEDIA-path fix across gateway, MCP, stream consumer, and TUI. It supersedes the narrower attempts:
Marked |
|
One correction on the triage note: the |
|
Thanks for the unified MEDIA-path work. Current main already incorporated a newer gateway-side media parsing architecture in Problems
Suggested changes
Automated hermes-sweeper review. |
|
Confirming the sweeper's read against current The live gaps the sweeper flags are real and still worth closing:
Right move is to salvage the MCP + TUI + auto-append portions against the current shared parser rather than rebase the old regex, and add the approved GIS extensions to |
Summary
Fixes #24032
Tests
scripts/run_tests.sh tests/gateway/test_platform_base.py::TestExtractMedia tests/gateway/test_stream_consumer.py::TestCleanForDisplay tests/gateway/test_send_image_file.py tests/test_mcp_serve.py::TestAttachmentExtraction tests/cron/test_scheduler.py::TestResolveDeliveryTargetnpm test -- --run src/__tests__/markdown.test.tsruff check gateway/platforms/base.py gateway/stream_consumer.py gateway/run.py mcp_serve.py tests/gateway/test_platform_base.py tests/gateway/test_stream_consumer.py tests/test_mcp_serve.py