Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Secured undefined path for existing refBuilders. #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/fbutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ exports.fbRef = function(path) {
};

exports.pathName = function(ref) {
if(typeof ref.parent === 'undefined') return ref.path;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see ref.path in the reference guide. Guessing a better answer here would be ref.ref.key, as that should work fine with Query and DatabaseReference instances?

Copy link
Author

@kleeb kleeb May 11, 2017

Choose a reason for hiding this comment

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

I don't see any usages except console.logs for this one, so more or less we can put anything here, so that the function does not throw exception and break the code flow. For my refBuilder ref.path was returning the path of monitor.
The main case is that for any refBuilder functions ref.parent is undefined.

var p = ref.parent.key;
return (p? p+'/' : '')+ref.key;
};
Expand Down