fix(uriproxy): better extractor
This commit is contained in:
parent
1a236589ed
commit
b6e48025fb
1 changed files with 4 additions and 2 deletions
|
@ -39,8 +39,10 @@ pub fn uri(base: &str, entity: UriClass, id: &str) -> String {
|
||||||
/// decompose local id constructed by uri() fn
|
/// decompose local id constructed by uri() fn
|
||||||
pub fn decompose_id(full_id: &str) -> String {
|
pub fn decompose_id(full_id: &str) -> String {
|
||||||
full_id // https://example.org/users/test/followers/page?offset=42
|
full_id // https://example.org/users/test/followers/page?offset=42
|
||||||
.split('/') // ['https:', '', 'example.org', 'users', 'test', 'followers', 'page?offset=42' ]
|
.replace("https://", "")
|
||||||
.nth(4) // 'test'
|
.replace("http://", "")
|
||||||
|
.split('/') // ['example.org', 'users', 'test', 'followers', 'page?offset=42' ]
|
||||||
|
.nth(2) // 'test'
|
||||||
.unwrap_or("")
|
.unwrap_or("")
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue