Skip to content

Commit

Permalink
Merge pull request #170 from filecoin-project/fix/allocator-repo-endi…
Browse files Browse the repository at this point in the history
…ng-in-git

Test if repo ends in .git
  • Loading branch information
clriesco committed Mar 27, 2024
2 parents 765b4e5 + 8b80bb3 commit 5d43c3b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fplus-lib/src/core/allocator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ fn content_items_to_allocator_model(file: ContentItems) -> Result<AllocatorModel
log::error!("Failed to parse allocator model");
return Err(LDNError::Load("Failed to parse allocator model".to_string()));
}

//If repo ends with .git, remove it
let mut repo = owner_repo_parts[owner_repo_parts.len() - 1].to_string();
if repo.ends_with(".git") {
repo = repo[..repo.len() - 4].to_string();
}

model.owner = Some(owner_repo_parts[owner_repo_parts.len() - 2].to_string());
model.repo = Some(owner_repo_parts[owner_repo_parts.len() - 1].to_string());
model.repo = Some(repo);

log::info!("Parsed allocator model successfully");
Ok(model)
Expand Down

0 comments on commit 5d43c3b

Please sign in to comment.