nodejs-firestore icon indicating copy to clipboard operation
nodejs-firestore copied to clipboard

FieldPath only escapes the first `\` and '`', resulting in INVALID_ARGUMENT response

Open pavadeli opened this issue 1 year ago • 1 comments

Environment details

  • OS: MacOS
  • Node.js version: latest
  • npm version: latest
  • @google-cloud/firestore version: v7.3.1

Steps to reproduce

  1. Try to use a FieldPath with multiple backslashes or backtick, for example:

    query.where(new FieldPath('containing multiple `` or backslashes \\\\'), '==', 0)
    
  2. 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).

pavadeli avatar Mar 15 '24 10:03 pavadeli

Thanks for reporting @pavadeli . I'll look into this.

ehsannas avatar Mar 18 '24 16:03 ehsannas