Skip to content

Commit 4a1f0ee

Browse files
committed
fix: use regex to strip only trailing .git from repo URLs
String.replace('.git', '') removes the first occurrence anywhere. Regex /\.git$/ only strips the trailing suffix, so URLs like .github.git are handled correctly.
1 parent 806d6a4 commit 4a1f0ee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

frontend/src/components/dashboard/RepoDetailView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function RepoDetailView({
7272
<div>
7373
<h1 className="text-2xl font-bold text-foreground">{repo.name}</h1>
7474
<a
75-
href={repo.git_url?.replace('.git', '')}
75+
href={repo.git_url?.replace(/\.git$/, '')}
7676
target="_blank"
7777
rel="noopener noreferrer"
7878
className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-primary transition-colors font-mono"
@@ -119,7 +119,7 @@ export function RepoDetailView({
119119
repoId={repoId}
120120
apiUrl={API_URL}
121121
apiKey={apiKey}
122-
repoUrl={repo.git_url?.replace('.git', '')}
122+
repoUrl={repo.git_url?.replace(/\.git$/, '')}
123123
defaultBranch={repo.branch}
124124
/>
125125
)}

0 commit comments

Comments
 (0)