mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 09:09:03 +03:00
13 lines
297 B
Rust
13 lines
297 B
Rust
use std::borrow::Cow;
|
|
|
|
pub fn encode_uri(v: &str) -> String {
|
|
let parts: Vec<_> = v.split('/').map(urlencoding::encode).collect();
|
|
parts.join("/")
|
|
}
|
|
|
|
pub fn decode_uri(v: &str) -> Option<Cow<str>> {
|
|
percent_encoding::percent_decode(v.as_bytes())
|
|
.decode_utf8()
|
|
.ok()
|
|
}
|