Skip to content

Commit 1f5b9f2

Browse files
Fix GitLab and Bitbucket URLs (#244)
1 parent c7d488b commit 1f5b9f2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/app/page.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ThemeToggle from '@/components/theme-toggle';
88
import Mermaid from '../components/Mermaid';
99
import ConfigurationModal from '@/components/ConfigurationModal';
1010
import ProcessedProjects from '@/components/ProcessedProjects';
11-
import { extractUrlPath } from '@/utils/urlDecoder';
11+
import { extractUrlPath, extractUrlDomain } from '@/utils/urlDecoder';
1212
import { useProcessedProjects } from '@/hooks/useProcessedProjects';
1313

1414
import { useLanguage } from '@/contexts/LanguageContext';
@@ -160,7 +160,18 @@ export default function Home() {
160160
owner = 'local';
161161
}
162162
else if (customGitRegex.test(input)) {
163-
type = 'web';
163+
// Detect repository type based on domain
164+
const domain = extractUrlDomain(input);
165+
if (domain?.includes('github.com')) {
166+
type = 'github';
167+
} else if (domain?.includes('gitlab.com') || domain?.includes('gitlab.')) {
168+
type = 'gitlab';
169+
} else if (domain?.includes('bitbucket.org') || domain?.includes('bitbucket.')) {
170+
type = 'bitbucket';
171+
} else {
172+
type = 'web'; // fallback for other git hosting services
173+
}
174+
164175
fullPath = extractUrlPath(input)?.replace(/\.git$/, '');
165176
const parts = fullPath?.split('/') ?? [];
166177
if (parts.length >= 2) {

0 commit comments

Comments
 (0)