fix(gateway): handle quoted MEDIA paths consistently across streaming and final deliveryy#12179
Open
Ruzzgar wants to merge 1 commit into
Open
fix(gateway): handle quoted MEDIA paths consistently across streaming and final deliveryy#12179Ruzzgar wants to merge 1 commit into
Ruzzgar wants to merge 1 commit into
Conversation
… and final delivery
e877d2b to
382d899
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes a gateway parsing mismatch for
MEDIA:directives when the file path is quoted or contains spaces.The adapter-side media parser already supported outputs like:
MEDIA: '/tmp/my image.png'MEDIA: "/tmp/my image.png"MEDIA: `/tmp/my image.png`But gateway-side handling still used simpler
MEDIA:(\S+)/MEDIA:\s*\S+patterns in a few places. That caused inconsistent behavior across delivery paths:gateway/run.pycould truncate the path at the first space during history/media dedupegateway/stream_consumer.pycould leave trailing path fragments visible in streamed textWhat changed
MEDIA:path parser helper ingateway/platforms/base.pygateway/run.pyfor history scanning and final-response media extractiongateway/stream_consumer.pyso quoted/spacedMEDIA:directives are stripped consistently from visible streamed textWhy this is a bug
BasePlatformAdapter.extract_media()already treated quoted/spacedMEDIA:paths as valid. The gateway had drifted from that behavior, so the same tool output could work in one path and break in another. This patch brings the gateway paths back into alignment with the existing adapter contract.Regression coverage
Added tests for:
MEDIA:directives from streamed visible textMEDIA:paths as a single path in gateway media extraction logicTest plan
Using the repo's Windows virtualenv at
.venv:tests/gateway/test_platform_base.pytests/gateway/test_stream_consumer.pytests/gateway/test_media_extraction.pyResult:
145 passed, 4 warnings in 1.63sAlso ran related gateway media tests:
tests/gateway/test_send_image_file.pytests/gateway/test_signal.pyResult:
85 passed, 4 warnings in 1.42s