Skip to content

Fix: Resolve default-routes.json path via fileURLToPath (fixes #107) - #112

Merged
taylortom merged 1 commit into
masterfrom
fix/windows-default-routes-path
Jul 3, 2026
Merged

Fix: Resolve default-routes.json path via fileURLToPath (fixes #107)#112
taylortom merged 1 commit into
masterfrom
fix/windows-default-routes-path

Conversation

@taylortom

Copy link
Copy Markdown
Collaborator

Fixes #107

Fix

  • Resolve the default-routes.json template path with fileURLToPath() instead of new URL(...).pathname. On Windows, URL.prototype.pathname returns a value like /C:/path/... (leading slash before the drive letter), which is not a valid path when passed on to readJson/fs.readFile; it also percent-encodes characters such as spaces and #. fileURLToPath handles drive letters, UNC paths, and decoding correctly on all platforms.
  • Extracted the resolution into a pure resolveModulePath(relativePath, baseUrl) util (barrel-exported from lib/utils.js) so it is unit-testable.

Testing

  • Added tests/utils-resolveModulePath.spec.js: resolves a relative path against a module URL, decodes percent-encoded characters that URL.pathname leaves escaped (asserting divergence from .pathname), and reads a real file from disk. This exercises the same class of bug on POSIX CI (via percent-encoding), which the Windows-only drive-letter symptom otherwise hides.
  • npx standard passes on the changed files.

@taylortom
taylortom merged commit 8688f75 into master Jul 3, 2026
2 checks passed
@taylortom
taylortom deleted the fix/windows-default-routes-path branch July 3, 2026 09:48
github-actions Bot pushed a commit that referenced this pull request Jul 3, 2026
## [4.0.1](v4.0.0...v4.0.1) (2026-07-03)

### Fix

* Resolve default-routes.json path via fileURLToPath (fixes #107) (#112) ([8688f75](8688f75)), closes [#107](#107) [#112](#112)
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 4.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: new URL().pathname leaves a leading / before the drive letter

1 participant