Skip to content

ObjectId.isValid should check buffter length #282

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

Merged
merged 2 commits into from
Nov 2, 2018

Conversation

clarkttfu
Copy link
Contributor

@clarkttfu clarkttfu commented Nov 2, 2018

const buff = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])

// returns true
ObjectId.isValid(buff) 
// TypeError: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
new ObjectId(buff)

@mbroadst
Copy link
Member

mbroadst commented Nov 2, 2018

Hi @clarkttfu, this looks good but would you be willing to provide a test as well?

Copy link
Contributor

@daprahamian daprahamian left a comment

Choose a reason for hiding this comment

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

👍

@clarkttfu
Copy link
Contributor Author

Hi @mbroadst, test case committed, please review.

Copy link
Member

@mbroadst mbroadst left a comment

Choose a reason for hiding this comment

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

LGTM

@daprahamian daprahamian merged commit 06af813 into mongodb:master Nov 2, 2018
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.

3 participants