Skip to content

fix(utils): make normalizePath idempotent by globally collapsing repeated slashes (#161) - #171

Open
duongynhi000005-oss wants to merge 1 commit into
tscircuit:mainfrom
duongynhi000005-oss:fix-161-idempotent-normalize-path
Open

duongynhi000005-oss wants to merge 1 commit into
tscircuit:mainfrom
duongynhi000005-oss:fix-161-idempotent-normalize-path

Conversation

@duongynhi000005-oss

Copy link
Copy Markdown

Summary

  • In lib/utils/normalize-path.ts, make the forward slash replacement global (/\/\/+/g) so all consecutive slash sequences are collapsed to a single slash, not just the first occurrence.
  • Ensures normalizePath is completely idempotent (e.g. normalizePath("a///b///c.txt") === "a/b/c.txt").
  • Adds unit tests in tests/utils/normalize-path.test.ts covering multi-group collapsing, idempotence, leading/trailing slashes, and Windows separators.

Fixes #161

/claim #161

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.

normalizePath is not idempotent when a path has multiple repeated slash groups

1 participant