nodejs-firestore
nodejs-firestore copied to clipboard
FieldPath only escapes the first `\` and '`', resulting in INVALID_ARGUMENT response
Environment details
- OS: MacOS
- Node.js version: latest
- npm version: latest
@google-cloud/firestoreversion: v7.3.1
Steps to reproduce
-
Try to use a FieldPath with multiple backslashes or backtick, for example:
query.where(new FieldPath('containing multiple `` or backslashes \\\\'), '==', 0) -
Run the query, then you get:
3 INVALID_ARGUMENT: Invalid property path ...
This is because of the use of replace in the following line: https://github.com/googleapis/nodejs-firestore/blob/e598b9daf628cbc54dc10dab80bb0f46e2a3e2a2/dev/src/path.ts#L624
The replace() method only replaces the first occurence of the given pattern (see MDN for more info).
Thanks for reporting @pavadeli . I'll look into this.