Skip to content

Commit 5305520

Browse files
fix(worker): skip non-directory paths in file-based git connection config
Fixes #1005 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 443d59c commit 5305520

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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)