Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Maintained the sidebar scroll position when navigating between chats instead of resetting to the top. [#1411](https://github.com/sourcebot-dev/sourcebot/pull/1411)
- Upgraded `nodemailer` to `^9.0.1`. [#1356](https://github.com/sourcebot-dev/sourcebot/pull/1356)
- Upgraded `@opentelemetry/core` to `^2.8.0`. [#1413](https://github.com/sourcebot-dev/sourcebot/pull/1413)
- Decoded percent-encoded characters in repo names derived from generic Git URLs, so direct URLs match the file-based behavior. [#1415](https://github.com/sourcebot-dev/sourcebot/pull/1415)

## [5.0.4] - 2026-06-18

Expand Down
20 changes: 19 additions & 1 deletion packages/backend/src/repoCompileUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,26 @@ describe('compileGenericGitHostConfig_url', () => {

expect(result.repoData).toHaveLength(1);
expect(result.repoData[0].name).toBe('github.com/test/repo');

const metadata = result.repoData[0].metadata as { gitConfig?: Record<string, string> };
expect(metadata.gitConfig!['zoekt.name']).toBe('github.com/test/repo');
});

test('should decode percent-encoded characters in the repo name', async () => {
mockedIsUrlAValidGitRepo.mockResolvedValue(true);

const config = {
type: 'git' as const,
url: 'https://github.com/test/Project%20Name%20With%20Spaces.git',
};

const result = await compileGenericGitHostConfig_url(config, 1);

expect(result.repoData).toHaveLength(1);
expect(result.repoData[0].name).toBe('github.com/test/Project Name With Spaces');
expect(result.repoData[0].displayName).toBe('github.com/test/Project Name With Spaces');

const metadata = result.repoData[0].metadata as { gitConfig?: Record<string, string> };
expect(metadata.gitConfig!['zoekt.name']).toBe('github.com/test/Project Name With Spaces');
});
});
4 changes: 3 additions & 1 deletion packages/backend/src/repoCompileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,11 @@ export const compileGenericGitHostConfig_url = async (
}
}

// Decode URL-encoded characters (e.g., %20 -> space) to ensure consistent repo names
const decodedPathname = decodeURIComponent(remoteUrl.pathname);
// @note: matches the naming here:
// https://github.com/sourcebot-dev/zoekt/blob/main/gitindex/index.go#L293
const repoName = path.join(remoteUrl.host, remoteUrl.pathname.replace(/\.git$/, ''));
const repoName = path.join(remoteUrl.host, decodedPathname.replace(/\.git$/, ''));

const repo: RepoData = {
external_codeHostType: 'genericGitHost',
Expand Down