Skip to content

Commit 34a1435

Browse files
fix(worker): skip non-directory paths in file-based git connection config (#1049)
* fix(worker): skip non-directory paths in file-based git connection config Fixes #1005 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: update CHANGELOG for #1049 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * c --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 443d59c commit 34a1435

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
### Fixed
1414
- Fixed Ask GitHub landing page chat box placement to be centered on the page instead of at the bottom. [#1046](https://github.com/sourcebot-dev/sourcebot/pull/1046)
15+
- Fixed issue where local git connections (`file://`) would fail when matching a file instead of a directory. [#1049](https://github.com/sourcebot-dev/sourcebot/pull/1049)
1516

1617
## [4.16.2] - 2026-03-25
1718

packages/backend/src/repoCompileUtils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { createLogger } from '@sourcebot/shared';
1414
import { BitbucketConnectionConfig, GerritConnectionConfig, GiteaConnectionConfig, GitlabConnectionConfig, GenericGitHostConnectionConfig, AzureDevOpsConnectionConfig } from '@sourcebot/schemas/v3/connection.type';
1515
import { ProjectVisibility } from "azure-devops-node-api/interfaces/CoreInterfaces.js";
1616
import path from 'path';
17+
import fs from 'fs/promises';
1718
import { glob } from 'glob';
1819
import { getLocalDefaultBranch, getOriginUrl, isPathAValidGitRepoRoot, isUrlAValidGitRepo } from './git.js';
1920
import assert from 'assert';
@@ -611,6 +612,14 @@ export const compileGenericGitHostConfig_file = async (
611612
logger.info(`Found ${repoPaths.length} path(s) matching pattern '${configUrl.pathname}'`);
612613

613614
await Promise.all(repoPaths.map((repoPath) => gitOperationLimit(async () => {
615+
const stat = await fs.stat(repoPath).catch(() => null);
616+
if (!stat || !stat.isDirectory()) {
617+
const warning = `Skipping ${repoPath} - path is not a directory.`;
618+
logger.warn(warning);
619+
warnings.push(warning);
620+
return;
621+
}
622+
614623
const isGitRepo = await isPathAValidGitRepoRoot({
615624
path: repoPath,
616625
});

0 commit comments

Comments
 (0)