Skip to content

fix(isMagnetURI): restore case-insensitive scheme matching - #2928

Open
FanWu-ai wants to merge 1 commit into
validatorjs:masterfrom
FanWu-ai:fix-magnet-uri-scheme-case-20261011
Open

FanWu-ai wants to merge 1 commit into
validatorjs:masterfrom
FanWu-ai:fix-magnet-uri-scheme-case-20261011

Conversation

@FanWu-ai

Copy link
Copy Markdown

The component regex accepts case-insensitive magnet schemes, but the prefix check introduced in #1992 rejects uppercase and mixed-case schemes before reaching it. Restore the previous behavior with an anchored case-insensitive prefix check, consistent with RFC 3986 §3.1.

The regression covers direct/later exact-topic parameters, BitTorrent v1/v2, and malformed-prefix controls. Query data and existing component validation are unchanged.

Validation on Node 24.19.0:

  • Pristine npm test: 323 passing.
  • Regression before fix: 323 passing, 1 failing.
  • Final npm test: 324 passing; all builds/minification, ESLint and coverage passed.
  • Coverage unchanged: 100% statements/functions/lines, 96.59% branches.
  • 4,992 cross-distribution assertions across six entry points and 768 additional scheme/prefix cases passed; git diff --check passed.
  • Other Node versions were not run locally; hosted checks are reported separately.

Checklist:

  • Source and regression changes only; generated files excluded.
  • README reviewed; existing contract unchanged.
  • Regression added and full test command passed.
  • RFC 3986 §3.1 and historical PR feat(isMagnetURI): support Bittorrent v2 #1992 referenced.

Prepared with OpenAI Codex assistance.

Restore the scheme case-insensitivity lost by the prefix guard in validatorjs#1992.
Add v1/v2, parameter-order and invalid-prefix regression cases.
@FanWu-ai
FanWu-ai marked this pull request as ready for review October 11, 2026 18:23
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