Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes access on deeply nested, nonexistent property #1432

Merged
merged 8 commits into from
Jan 26, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Fixes access on deeply nested, nonexistent property. (#1432)
- Add features to task queue functions. (#1423)
- Add traces to V2 Firestore trigger logs. (#1440)
1 change: 1 addition & 0 deletions spec/v1/providers/database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ describe("DataSnapshot", () => {
populate(applyChange({ a: 23 }, { b: 33 }));
expect(subject.child("a/b").val()).to.be.null;
expect(subject.child("b/c").val()).to.be.null;
expect(subject.child("a/b/c").val()).to.be.null;
});

it("should return a leaf value", () => {
Expand Down
3 changes: 3 additions & 0 deletions src/common/providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ export class DataSnapshot implements database.DataSnapshot {
let source = this._data;
if (parts.length) {
for (const part of parts) {
if (source[part] === undefined) {
return null;
}
source = source[part];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/v2/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export function getGlobalOptions(): GlobalOptions {
* Additional fields that can be set on any event-handling function.
*/
export interface EventHandlerOptions extends Omit<GlobalOptions, "enforceAppCheck"> {
/** Type of the event. Valid values are TODO */
/** Type of the event. Valid values are TODO */
eventType?: string;

/** TODO */
Expand Down