Skip to content

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

@pavadeli

Description

@pavadeli

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:

: '`' + str.replace('\\', '\\\\').replace('`', '\\`') + '`';

The replace() method only replaces the first occurence of the given pattern (see MDN for more info).

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/nodejs-firestore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions