Skip to main content

normalize_path

Function normalize_path 

Source
pub fn normalize_path(raw: &str) -> (String, bool)
Expand description

Normalize a URL path.

Steps:

  1. Percent-decode (detecting double-encoding).
  2. If double-encoded, decode the result a second time.
  3. NFKC Unicode normalization (fullwidth → ASCII, ligatures → components).
  4. Strip null bytes.
  5. Lowercase.
  6. Resolve . / .. segments and collapse consecutive slashes.

Returns (normalized_path, double_encoding_detected).