Function opendal::raw::normalize_root
source · pub fn normalize_root(v: &str) -> String
Expand description
Make sure root is normalized to style like /abc/def/
.
§Normalize Rules
- All whitespace will be trimmed:
abc/def
=>abc/def
- All leading / will be trimmed:
///abc
=>abc
- Internal // will be replaced by /:
abc///def
=>abc/def
- Empty path will be
/
: `` =>/
- Add leading
/
if not starts with:abc/
=>/abc/
- Add trailing
/
if not ends with:/abc
=>/abc/
Finally, we will get path like /path/to/root/
.