forked from alemi/upub
fix: id extractor
This commit is contained in:
parent
db369683a0
commit
a6b6ca6965
1 changed files with 1 additions and 5 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue