Skip to content

Commit

Permalink
make identifier regex in makeKeyGeneric more restrictive
Browse files Browse the repository at this point in the history
makeKeyGeneric only allows letters  as part of an identifier in $[<identifier>]
  • Loading branch information
kfritsch authored Mar 30, 2021
1 parent 46c642f commit 662b692
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongo-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ export default class MongoObject {
*/
static makeKeyGeneric(key) {
if (typeof key !== 'string') return null;
return key.replace(/\.([0-9]+|\$\[.*\])(?=\.|$)/g, '.$');
return key.replace(/\.([0-9]+|\$\[[a-zA-Z]*\])(?=\.|$)/g, '.$');
}

/** Takes a string representation of an object key and its value
Expand Down

0 comments on commit 662b692

Please sign in to comment.