diff --git a/ixx/src/action/index.rs b/ixx/src/action/index.rs index 0d47f41..2dffac4 100644 --- a/ixx/src/action/index.rs +++ b/ixx/src/action/index.rs @@ -117,7 +117,8 @@ fn into_option( fn update_declaration(url_prefix: &Url, declaration: Declaration) -> anyhow::Result { let mut url = match declaration { Declaration::StorePath(path) => { - let idx = path + if path.starts_with("/") { + let idx = path .match_indices('/') .nth(3) .ok_or_else(|| anyhow!("Invalid store path: {}", path))? @@ -125,7 +126,10 @@ fn update_declaration(url_prefix: &Url, declaration: Declaration) -> anyhow::Res // +1 to also remove the / itself, when we join it with a url, the path in the url would // get removed if we won't remove it. + 1; - url_prefix.join(path.split_at(idx).1)? + url_prefix.join(path.split_at(idx).1)? + } else { + url_prefix.join(&path)? + } } Declaration::Url { name: _, url } => url, };