Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex for UUID is wrong. #418

Open
TroyKomodo opened this issue Oct 22, 2024 · 4 comments
Open

Regex for UUID is wrong. #418

TroyKomodo opened this issue Oct 22, 2024 · 4 comments

Comments

@TroyKomodo
Copy link

TroyKomodo commented Oct 22, 2024

> import { MongoClient, UUID } from "@db/mongo";
undefined
> UUID.createFromHexString("0192B4AE-79EF-418D-9FBE-C7529E22AF86".toLowerCase())
new UUID("0192b4ae-79ef-418d-9fbe-c7529e22af86")
> UUID.createFromHexString("0192B4AE-F8D4-B461-4C17-A188B212576D".toLowerCase())
Uncaught BSONError: UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
    at uuidHexStringToBuffer (https://jsr.io/@lucsoft/web-bson/0.3.1/mod.js:288:15)
    at Function.createFromHexString (https://jsr.io/@lucsoft/web-bson/0.3.1/mod.js:597:24)
    at <anonymous>:1:27
> 
@lucsoft
Copy link
Collaborator

lucsoft commented Oct 22, 2024

mongo only allows UUIDv4, is this a valid uuidv4?

@TroyKomodo
Copy link
Author

Is that true? The upstream mongo driver allows any uuid and mongo treats uuid as just a byte array it seems.

@lucsoft
Copy link
Collaborator

lucsoft commented Nov 1, 2024

@TroyKomodo ah i misread, it generates a uuidv4

@erfanium
Copy link
Member

erfanium commented Nov 1, 2024

@lucsoft I wonder how this error is even possible? [email protected] is basically a fork of official bson lib with no logical changes.

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

No branches or pull requests

3 participants