fix: re-encode WebSocket proxy query params so spaces use %20 (#9041)#9064
Merged
Conversation
Filenames with spaces failed LSP connections because Starlette decodes query-string spaces as '+' (form-urlencoded) while python-lsp-server expects percent-encoding (%20). Apply unquote_plus → quote on forwarded query params to normalize the encoding.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes WebSocket proxying for LSP connections by normalizing forwarded query parameter encoding so that spaces are percent-encoded (%20) instead of being represented in a form-encoding style that can break upstream servers like python-lsp-server.
Changes:
- Re-encode proxied WebSocket query param values via
quote(...)before connecting upstream. - Add a focused test to validate space normalization behavior for proxied WebSocket query params.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
marimo/_server/api/middleware.py |
Re-encodes WebSocket query param values when building the upstream ws_url. |
tests/_server/api/test_middleware.py |
Adds a unit test covering + → %20 normalization and related cases. |
…al plus signs unquote_plus is redundant since Starlette already decodes query params, and it corrupts values containing literal '+' (from %2B) by turning them into spaces. Using just quote(v) correctly re-encodes already-decoded values.
dmadisetti
approved these changes
Apr 6, 2026
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.22.5-dev15 |
1 task
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.
Filenames with spaces failed LSP connections because Starlette decodes query-string spaces as '+' (form-urlencoded) while python-lsp-server expects percent-encoding (%20). Apply unquote_plus → quote on forwarded query params to normalize the encoding.