Skip to content

Commit de49bdd

Browse files
cliffhallclaude
andcommitted
fix(filesystem): say the client exposes no valid roots, not none
An update whose roots are all invalid still lists roots; the empty-allow-list message now says none of them is valid (Copilot on #5095). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 5ea217b commit de49bdd

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/filesystem/__tests__/server-paths.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe("relative paths", () => {
164164
path: "anything.txt",
165165
});
166166
expect(textOf(result)).toBe(
167-
`Access denied - no allowed directories: the client's roots expose none (${path.resolve(process.cwd(), "anything.txt")})`,
167+
`Access denied - no allowed directories: the client exposes no valid roots (${path.resolve(process.cwd(), "anything.txt")})`,
168168
);
169169
} finally {
170170
await empty.close();

‎src/filesystem/__tests__/server-roots.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ describe("roots/list_changed", () => {
274274
const result = await call(client, "list_directory", { path: rootDir });
275275
expect(result.isError).toBe(true);
276276
expect(textOf(result)).toMatch(
277-
/^Access denied - no allowed directories: the client's roots expose none/,
277+
/^Access denied - no allowed directories: the client exposes no valid roots/,
278278
);
279279
// The command-line directories do not come back either.
280280
expect(

‎src/filesystem/lib.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export async function validatePath(
234234
if (!isAllowed) {
235235
throw new Error(
236236
allowedDirectories.length === 0
237-
? `Access denied - no allowed directories: the client's roots expose none (${absolute})`
237+
? `Access denied - no allowed directories: the client exposes no valid roots (${absolute})`
238238
: `Access denied - path outside allowed directories: ${absolute} not in ${allowedDirectories.join(", ")}`,
239239
);
240240
}

0 commit comments

Comments
 (0)