mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
feat: path level access control (#52)
BREAKING CHANGE: `--auth` is changed, `--no-auth-access` is removed
This commit is contained in:
12
src/utils.rs
Normal file
12
src/utils.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user