1
0
Fork 0
forked from alemi/upub

fix: id extractor

This commit is contained in:
əlemi 2024-03-20 11:00:21 +01:00
parent db369683a0
commit a6b6ca6965
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -63,11 +63,7 @@ impl Context {
/// get bare uri, usually an uuid but unspecified /// get bare uri, usually an uuid but unspecified
pub fn id(&self, id: String) -> String { pub fn id(&self, id: String) -> String {
if id.starts_with(&self.0.domain) { if id.starts_with(&self.0.domain) {
let mut out = id.replace(&self.0.domain, ""); id.split('/').last().unwrap_or("").to_string()
if out.ends_with('/') {
out.replace_range(out.len()-1.., "");
}
out
} else { } else {
id id
} }