Commit 6f30b4e
committed
fix(ObjectId): will now throw if an invalid character is passed
If a non-hex string of length 12 is passed into the ObjectId
constructor, we generate a hexString based off of the character
codes of the passed in id. This requires that the passed id consist
entirely of characters with values < 256 in utf-16. Previously,
we let this silently fail and generated invalid hex string. Now,
we throw a TypeError
Fixes NODE-1737
BREAKING CHANGE:
Where code was previously silently erroring, users may now
experience TypeErrors1 parent c6701fc commit 6f30b4e
2 files changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| |||
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
114 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
115 | 128 | | |
116 | 129 | | |
117 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
0 commit comments