Skip to content

Conversation

@albertnis
Copy link
Contributor

Previously, only the first backslash and backtick was being escaped. This broke update and set (merge) calls when a field path contained multiple backslashes.

replaceAll is an alternative here, but I think a global regex has better compatibility with older versions of Node.

Fixes #2019 🦕

@albertnis albertnis requested review from a team as code owners December 12, 2024 21:50
@google-cla
Copy link

google-cla bot commented Dec 12, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: firestore Issues related to the googleapis/nodejs-firestore API. labels Dec 12, 2024
Previously, only the first backslash and backtick was being escaped. This broke `update` and `set (merge)` calls when a field path contained multiple backslashes.

`replaceAll` is an alternative here, but I think a global regex has better compatibility with older versions of Node.
Copy link
Contributor

@dconeybe dconeybe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, and the updated unit tests!

@dconeybe dconeybe added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Dec 13, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 13, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 13, 2024
@MarkDuckworth MarkDuckworth changed the base branch from main to community/albertnis/fix-escape December 13, 2024 18:54
@MarkDuckworth MarkDuckworth merged commit b8cbf9a into googleapis:community/albertnis/fix-escape Dec 13, 2024
13 checks passed
dconeybe pushed a commit that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the googleapis/nodejs-firestore API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants