mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-10-07 12:58:49 +08:00
fix: normalize path separators in no-direct-agent-server-calls test for Windows (#488)
On Windows, path.relative() returns backslash-separated paths, but ALLOWED_AD_HOC_HTTP_FILES uses forward slashes. The Set.has() check therefore never matches on Windows, causing false positive violations. Normalize relPath to forward slashes before the check so the test passes correctly on all platforms. Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
committed by
GitHub
co-authored by
openhands
parent
e9b5e07293
commit
38121aaf2f
@@ -12,7 +12,9 @@ const ALLOWED_AD_HOC_HTTP_FILES = new Set([
|
||||
function collectSourceFiles(dir: string): string[] {
|
||||
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
||||
const fullPath = join(dir, entry.name);
|
||||
const relPath = relative(SRC_ROOT, fullPath);
|
||||
// Normalize to forward slashes so the path matches ALLOWED_AD_HOC_HTTP_FILES
|
||||
// entries on Windows where path.relative() returns backslash-separated paths.
|
||||
const relPath = relative(SRC_ROOT, fullPath).replace(/\\/g, "/");
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
if (EXCLUDED_SEGMENTS.has(entry.name)) return [];
|
||||
|
||||
Reference in New Issue
Block a user