fix(core): encode reserved path chars in file URIs#151
Open
dergachoff wants to merge 1 commit into
Open
Conversation
aceae78 to
07196a4
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
Fixes #150.
path_to_uriformatted file URIs asfile://{path}. Valid filesystem paths containing URI-reserved characters, such as bracketed route filenames, produced invalid raw URI paths.lsp_types::Uri::from_strthen returnedUnexpectedChar; because this path usedexpect, diagnostics requests could panic and abort the MCP stdio server.This builds platform-aware file URLs with
Url::from_file_path, preserves the existing Windows-rooted synthetic test-path behavior, encodes RFC3986-invalid path characters that WHATWG URL leaves raw in the path ([,],^,|), and adds a regression test for a route-style filename withuri_to_pathround-trip coverage.Validation
cargo +nightly fmt --checkcargo +1.95 test -p mcpls-core path_to_uricargo +1.95 test -p mcpls-corecargo +1.95 clippy -p mcpls-core --all-targets --all-features -- -D warningsrustup target add --toolchain 1.95 x86_64-pc-windows-msvc && cargo +1.95 check -p mcpls-core --target x86_64-pc-windows-msvc --all-targets --all-featuresget_diagnosticson a bracketed route path aborted withfailed to create URI from path: ParseError { ... UnexpectedChar }; after the patch, the same call returned a normal tool response.