Skip to content

fix(uuid-generator): inspect GUIDs in braces and urn:uuid: values - #415

Merged
anurag629 merged 1 commit into
codercops:developfrom
prakashNalla:fix/414-uuid-wrapped-forms
Oct 28, 2026
Merged

anurag629 merged 1 commit into
codercops:developfrom
prakashNalla:fix/414-uuid-wrapped-forms

Conversation

@prakashNalla

Copy link
Copy Markdown
Contributor

What and why

The UUID inspector rejected a GUID in braces ({3f2504e0-...}, as .NET and the Windows registry show them) and a urn:uuid: value, because inspectUuid() tested the trimmed text against UUID_PATTERN before anything else. It now drops a leading urn:uuid: (any case) or one pair of surrounding braces first, then checks and decodes the rest as before. Unbalanced or doubled braces, braces after urn:uuid:, and other prefixes stay invalid.

The UUID guide said braces are reported as invalid, and its example test pinned that, so I updated that line to say both forms are accepted and changed the test to match.

Closes #414

How I tested this

  • Added cases to lib/__tests__/uuid.test.ts: braces, urn:uuid:, URN:UUID: and surrounding whitespace each inspect the same as the bare UUID, and five malformed wrappers stay invalid. The 4 accepting cases fail without the change.
  • npm run lint: 0 errors, the same 11 warnings as on develop.
  • npm run test: 64 files, 2435 tests pass.
  • npm run build: passes.
  • npm run dev, /uuid-generator: the bare value, {...} and urn:uuid:... all show Version 4 and Variant RFC 9562, and {... without the closing brace shows no result.

AI assistance

Claude helped me w/ understand the issue

Type of change

  • Bug fix

Checklist

  • I was assigned the linked issue
  • npm run lint && npm run test && npm run build passes locally
  • Logic changes live in lib/ and have a test in lib/__tests__/
  • For a bug fix: the new test fails without my change
  • No analytics, trackers, or calls that send user data off-device
  • Works in both light and dark themes (if UI changed)
  • Inputs have labels and it works with the keyboard alone (if UI changed)
  • New tool: registry entry, page.tsx, client component, opengraph-image.tsx, and the bug report dropdown are all done

@anurag629 anurag629 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @prakashNalla. Lint (develop's 11 warnings), all 2435 tests, the build and the pages pass on top of develop. Braces and urn:uuid: (any case, with spaces around) now inspect like the bare UUID, while {abc..., double braces, urn:uuid:{...} and a bare uuid: prefix stay invalid, and good catch updating the guide line that told people to remove the braces.

@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 28, 2026
@anurag629
anurag629 merged commit d1d5c7a into codercops:develop Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UUID Inspector: a GUID in braces or a urn:uuid: value is reported as invalid

2 participants