You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
encode_rfc3986_path_chars currently encodes [, ], ^, and |. RFC 3986 §2.2 also lists {, }, and backtick (`) as characters not permitted unencoded in a path segment. These are rare in practice, but omitting them produces technically non-conformant URIs.
Current behavior
let encoded_path = path
.replace('[',"%5B").replace(']',"%5D").replace('^',"%5E").replace('|',"%7C");// { } ` are not encoded
Expected behavior
All RFC 3986 §2.2 "other" reserved characters ([, ], ^, |, {, }, `) are percent-encoded in the path component.
Notes
Risk is low: rust-analyzer, pyright, and other LSP servers use WHATWG URL parsing which is more permissive.
The fix is a trivial addition of three more .replace() calls (or a switch to percent-encoding via a crate).
Description
encode_rfc3986_path_charscurrently encodes[,],^, and|. RFC 3986 §2.2 also lists{,}, and backtick (`) as characters not permitted unencoded in a path segment. These are rare in practice, but omitting them produces technically non-conformant URIs.Current behavior
Expected behavior
All RFC 3986 §2.2 "other" reserved characters (
[,],^,|,{,},`) are percent-encoded in the path component.Notes
.replace()calls (or a switch to percent-encoding via a crate).encode_rfc3986_path_chars(e.g., after theurl::Positioncorrectness fix in fix(core): encode reserved path chars in file URIs #151).