Skip to content

Commit

Permalink
fix(webserver): use full name for repositories and strip .git from urls
Browse files Browse the repository at this point in the history
  • Loading branch information
boxbeam committed Apr 26, 2024
1 parent e9d3814 commit f028fea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion ee/tabby-webserver/src/cron/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ async fn refresh_repositories_for_provider(
.strip_prefix("git://")
.map(|url| format!("https://{url}"))
.unwrap_or(url);
let url = url.strip_suffix(".git").unwrap_or(&url);

service
.upsert_github_provided_repository(provider.id.clone(), id, repo.name, url)
.upsert_github_provided_repository(
provider.id.clone(),
id,
repo.full_name.unwrap_or(repo.name),
url.to_string(),
)
.await?;
}

Expand Down
8 changes: 5 additions & 3 deletions ee/tabby-webserver/src/cron/gitlab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ async fn refresh_repositories_for_provider(
};
for repo in repos {
let id = repo.id.to_string();
let url = repo.http_url_to_repo;
let url = url.strip_suffix(".git").unwrap_or(&url);

service
.upsert_gitlab_provided_repository(
provider.id.clone(),
id,
repo.name,
repo.http_url_to_repo,
repo.name_with_namespace,
url.to_string(),
)
.await?;
}
Expand All @@ -71,7 +73,7 @@ async fn refresh_repositories_for_provider(
#[derive(Deserialize)]
struct Repository {
id: u128,
name: String,
name_with_namespace: String,
http_url_to_repo: String,
}

Expand Down

0 comments on commit f028fea

Please sign in to comment.