diff --git a/src/server/context.rs b/src/server/context.rs index bbad080..765d937 100644 --- a/src/server/context.rs +++ b/src/server/context.rs @@ -124,7 +124,7 @@ impl Context { uriproxy::uri(self.base(), UriClass::Context, id) } - /// get bare id, which is uuid for local stuff and ~{uri|base64} for remote stuff + /// get bare id, which is uuid for local stuff and +{uri|base64} for remote stuff pub fn id(&self, full_id: &str) -> String { if self.is_local(full_id) { uriproxy::decompose_id(full_id) diff --git a/uriproxy/src/lib.rs b/uriproxy/src/lib.rs index 41dc53f..2feb6ba 100644 --- a/uriproxy/src/lib.rs +++ b/uriproxy/src/lib.rs @@ -21,8 +21,8 @@ impl AsRef for UriClass { /// unpack uri in id if valid, otherwise compose full uri with "{base}/{entity}/{id}" pub fn uri(base: &str, entity: UriClass, id: &str) -> String { - if id.starts_with('~') { // ready-to-use base64-encoded id - if let Ok(bytes) = base64::prelude::BASE64_STANDARD.decode(id) { + if id.starts_with('+') { // ready-to-use base64-encoded id + if let Ok(bytes) = base64::prelude::BASE64_URL_SAFE.decode(id) { if let Ok(uri) = std::str::from_utf8(&bytes) { return uri.to_string(); } @@ -40,8 +40,8 @@ pub fn decompose_id(full_id: &str) -> String { .to_string() } -/// encode with base64 remote url and prefix it with ~ +/// encode with base64 remote url and prefix it with + pub fn compact_id(uri: &str) -> String { - let encoded = base64::prelude::BASE64_STANDARD.encode(uri.as_bytes()); - format!("~{encoded}") + let encoded = base64::prelude::BASE64_URL_SAFE.encode(uri.as_bytes()); + format!("+{encoded}") }