Skip to content

Commit

Permalink
declaration: handle nixpkgs edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding committed Oct 20, 2024
1 parent d8c1089 commit 58708da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ixx/src/action/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ fn into_option(
fn update_declaration(url_prefix: &Url, declaration: Declaration) -> anyhow::Result<Url> {
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))?
.0
// +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,
};
Expand Down

0 comments on commit 58708da

Please sign in to comment.