Skip to main content

normalize_folder

Function normalize_folder 

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

Normalize a user-typed folder path into the storage form: no leading slash, single trailing slash on non-empty paths, collapsed runs of slashes, and segment trim. Empty input (or /) → root ("").

Examples:

  • " /marketing/cta/ " → "marketing/cta/"
  • "//foo///bar" → "foo/bar/"
  • "" / "/" → ""