Merge pull request #3679 from MoerAI/fix/file-uri-rejection-explanation

fix(resolve-file-uri): explain project boundary restriction in rejection warning (fixes #3554)
This commit is contained in:
YeonGyu-Kim
2026-05-01 19:18:43 +09:00
committed by GitHub
2 changed files with 13 additions and 1 deletions
@@ -161,4 +161,16 @@ describe("resolvePromptAppend", () => {
expect(resolved).toContain("[WARNING: Path rejected:") expect(resolved).toContain("[WARNING: Path rejected:")
expect(resolved).not.toContain("absolute-content") expect(resolved).not.toContain("absolute-content")
}) })
test("rejection warning explains the project boundary restriction (issue #3554)", () => {
//#given
const input = `file://${absoluteFilePath}`
//#when
const resolved = resolvePromptAppend(input, configDir)
//#then
expect(resolved).toContain("[WARNING: Path rejected:")
expect(resolved).toMatch(/outside project root/i)
})
}) })
@@ -27,7 +27,7 @@ export function resolvePromptAppend(promptAppend: string, configDir?: string): s
filePath, filePath,
projectRoot, projectRoot,
}) })
return `[WARNING: Path rejected: ${promptAppend}]` return `[WARNING: Path rejected: ${promptAppend} (resolved outside project root ${projectRoot}; file:// prompts must reside within the project boundary)]`
} }
if (!existsSync(filePath)) { if (!existsSync(filePath)) {