Skip to content

fix: match Windows filesystem paths in error stack frame filtering - #1343

Open
ragib-mrb wants to merge 1 commit into
porsager:masterfrom
ragib-mrb:fix/errors-ours-windows-paths
Open

ragib-mrb wants to merge 1 commit into
porsager:masterfrom
ragib-mrb:fix/errors-ours-windows-paths

Conversation

@ragib-mrb

Copy link
Copy Markdown
Contributor

Problem

In src/errors.js, locations() records url.href and decodeURIComponent(url.pathname) (e.g. /D:/.../postgres/src/), and ours() only checks !rest.includes('/').

On Windows, stack frames using native filesystem paths (D:\...\postgres\src\query.js:12:3) neither match /D:/.../src/ nor check for backslash subdirectory separators (\), so ours() returns false for internal postgres/src/*.js frames and leaks them into rewritten error stacks.

Fix

  • Add the Windows filesystem path form (pathname.slice(1).replace(/\//g, '\\')) to locations() when pathname starts with a Windows drive prefix (/^\/[A-Za-z]:\//), with no Node-only imports so edge runtimes remain unaffected.
  • Reject both / and \ in the remaining segment of ours() so subdirectory paths are still excluded.
  • Add a regression test in tests/errors.js.

Verification

  • Verified ours() directly in Node on Windows for file:/// URLs, Windows backslash paths, and subdirectory exclusions (fails before fix with ours(winPath) === false; passes after fix)

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.

1 participant