(tui): Decode percent-escaped bare local file links (#16810)

Addresses #16622

Problem: bare local file links in TUI markdown render percent-encoded
path bytes literally, unlike file:// links.

Solution: decode bare path targets before local-path expansion and add
regression coverage for spaces and Unicode.
This commit is contained in:
Eric Traut
2026-04-06 08:52:18 -07:00
committed by GitHub
parent f44eb29181
commit 54dbbb839e
4 changed files with 17 additions and 1 deletions

View File

@@ -789,7 +789,9 @@ fn parse_local_link_target(dest_url: &str) -> Option<(String, Option<String>)> {
location_suffix = Some(suffix);
}
Some((expand_local_link_path(path_text), location_suffix))
let decoded_path_text =
urlencoding::decode(path_text).unwrap_or(std::borrow::Cow::Borrowed(path_text));
Some((expand_local_link_path(&decoded_path_text), location_suffix))
}
/// Normalize a hash fragment like `L12` or `L12C3-L14C9` into the display suffix we render.