Skip to content

Commit a7eae3d

Browse files
DeusDatapandazhangS
authored andcommitted
fix(mcp): normalize the autoindex.skip root path in diagnostics (DeusData#713)
The autoindex over-limit skip warning logged `root=` with the raw srv->session_root, which on Windows carries backslashes. The DeusData#713 guard test autoindex_limit_guards_non_git_root_issue713 asserts the warning names the skipped root via strstr(root, "/repo"), so it failed on the Windows CLANG64 (x86_64) leg where the path is `...\repo`. Normalize the logged root to forward slashes with cbm_normalize_path_sep() (a no-op on POSIX), matching cbm's forward-slash path convention used everywhere else in the graph and MCP output; the diagnostic is now identical across platforms. Production-side fix, not a test relaxation. Signed-off-by: Martin Vogel <[email protected]>
1 parent 2de3309 commit a7eae3d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/mcp/mcp.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17576,9 +17576,13 @@ static void maybe_auto_index(cbm_mcp_server_t *srv) {
1757617576
char limit[32];
1757717577
(void)snprintf(files, sizeof(files), "%d", file_count);
1757817578
(void)snprintf(limit, sizeof(limit), "%d", file_limit);
17579+
char root_disp[CBM_SZ_1K];
17580+
(void)snprintf(root_disp, sizeof(root_disp), "%s", srv->session_root);
17581+
cbm_normalize_path_sep(
17582+
root_disp); /* forward-slash paths in diagnostics (Windows \\ -> /) */
1757917583
cbm_log_warn("autoindex.skip", "reason",
1758017584
file_count >= 0 ? "too_many_files" : "unsafe_or_unavailable_path", "files",
17581-
files, "limit", limit, "root", srv->session_root);
17585+
files, "limit", limit, "root", root_disp);
1758217586
return;
1758317587
}
1758417588

0 commit comments

Comments
 (0)