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:
@@ -161,4 +161,16 @@ describe("resolvePromptAppend", () => {
|
||||
expect(resolved).toContain("[WARNING: Path rejected:")
|
||||
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,
|
||||
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)) {
|
||||
|
||||
Reference in New Issue
Block a user