Skip to main content

sanitize_name

Function sanitize_name 

Source
pub fn sanitize_name(raw: &str) -> String
Expand description

Stricter sibling of sanitize_for_terminal for structured fields (node names, paths, link targets) where a newline is never legitimate content. Strips every ASCII control byte (including \n/\t), every Unicode bidirectional-override character, and the Unicode line/paragraph separators, so a hostile name/path can neither inject extra lines that masquerade as separate output rows nor visually spoof its own content (e.g. a bidi override making an extension display reversed).