Skip to content

fix: use normalizePathSeparators in formatAppFilePath for Windows compatibility#2426

Merged
james-elicx merged 1 commit into
cloudflare:mainfrom
kushdab:fix/windows-path-normalization
Jun 30, 2026
Merged

fix: use normalizePathSeparators in formatAppFilePath for Windows compatibility#2426
james-elicx merged 1 commit into
cloudflare:mainfrom
kushdab:fix/windows-path-normalization

Conversation

@kushdab

@kushdab kushdab commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

formatAppFilePath in app-route-graph.ts was using inline .replace(/\\\\/g, "/") to normalize path separators instead of the shared normalizePathSeparators utility already imported at the top of the file.

This fixes two call sites within formatAppFilePath:

- const relativePath = path.relative(appDir, filePath).replace(/\\\\/g, "/");
+ const relativePath = normalizePathSeparators(path.relative(appDir, filePath));
  const parsedPath = path.parse(relativePath);
- const withoutExtension = path.join(parsedPath.dir, parsedPath.name).replace(/\\\\/g, "/");
+ const withoutExtension = normalizePathSeparators(path.join(parsedPath.dir, parsedPath.name));

normalizePathSeparators was already imported and used in scanWithExtensions (file-matcher.ts) for the same reason — this migrates the remaining per-callsite inline replacements in app-route-graph.ts to the shared utility, consistent with how #1578 and #1604 addressed the same class of bug elsewhere.

@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@2426
npm i https://pkg.pr.new/vinext@2426

commit: ed8125a

@james-elicx james-elicx enabled auto-merge (squash) June 30, 2026 07:53
@james-elicx james-elicx merged commit 53da079 into cloudflare:main Jun 30, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants