Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

fix: not check index exclusion path for null values#1330

Merged
danieljbruce merged 3 commits intogoogleapis:mainfrom
mrnagydavid:index-exclusion-problem-statement
Nov 20, 2024
Merged

fix: not check index exclusion path for null values#1330
danieljbruce merged 3 commits intogoogleapis:mainfrom
mrnagydavid:index-exclusion-problem-statement

Conversation

@mrnagydavid
Copy link
Copy Markdown
Contributor

This PR fixes issue #1327 🦕

Summary

Considering the following 4 types of index exclusions:

  1. excludeFromindexes: ['foo.*']
  2. excludeFromindexes: ['foo.bar']
  3. excludeFromindexes: ['foo[].*']
  4. excludeFromindexes: ['foo[].bar']

Supplying { entity: { foo: null } } throws for 2 and 3, but not for 1 and 4.

save({ excludeFromIndexes: ['foo.bar'], entity: { sho: 1, foo: null })
// throws TypeError: Cannot read properties of undefined (reading 'properties')

save({ excludeFromIndexes: ['foo[].*'], entity: { sho: 1, foo: null })
// throws TypeError: Cannot read properties of undefined (reading 'values')

With the changes in this PR, the save calls will not throw in any of the 4 cases.

@mrnagydavid mrnagydavid requested a review from a team as a code owner October 4, 2024 09:39
@mrnagydavid mrnagydavid requested a review from a team October 4, 2024 09:39
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: datastore Issues related to the googleapis/nodejs-datastore API. labels Oct 4, 2024
@danieljbruce danieljbruce requested a review from a team as a code owner November 1, 2024 14:10
@danieljbruce danieljbruce merged commit 5c0ddbc into googleapis:main Nov 20, 2024
@danieljbruce
Copy link
Copy Markdown
Contributor

For additional notes on this PR see this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants