8000 Fix file and folder searches with stateful regular expressions by UmutAlisoglu · Pull Request #981 · Stuk/jszip · GitHub
[go: up one dir, main page]

Skip to content

Fix file and folder searches with stateful regular expressions - #981

Open
UmutAlisoglu wants to merge 1 commit into
Stuk:mainfrom
UmutAlisoglu:codex/stateless-regex-search
Open

UmutAlisoglu wants to merge 1 commit into
Stuk:mainfrom
UmutAlisoglu:codex/stateless-regex-search

Conversation

@UmutAlisoglu
Copy link
Copy Markdown

file(/Readme/g) skips matching entries because RegExp.test() carries lastIndex from one filename into the next. folder(regex) has the same issue, and reusing a regex can change the result.

Test each path from index zero for global/sticky expressions, then restore the caller's lastIndex. Ordinary expressions keep their existing path. The regressions cover file searches, relative folder searches, nonzero starting positions and repeated queries. Both new tests fail on the original source and pass with the fix.

Validation on Windows / Node 24.21.0:

  • Node suite: 197 tests passed.
  • Chromium, Firefox and WebKit: 3,319 assertions passed in each browser.
  • ESLint passed.
  • TypeScript passed using an isolated @types/node@16.18.11 type root, compatible with the locked TypeScript version. The default lookup picks up unrelated, newer Node types from a parent workspace.
  • Manual checks for sticky regexes and frozen ordinary regexes passed.

No dependency or generated bundle changes are included.

AI-assisted with OpenAI Codex, including implementation and verification.

This branch has not been deployed

No deployments
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

0