Issue with Firebase database REST API URL having c

2019-08-01 08:32发布

Firebase is not able to store data if any of the node in the json tree path contain character "." i.e period

Example

https://.firebaseio.com/path/to/node/.json Will store the data in above specified json tree node.

However, consider below query where I have a "." character in my url

https://.firebaseio.com/path/to/node.speical/.json

It will return

{
"error": "Invalid path: Invalid token in path"
}

Is this something because firebase server have not handled this case appropriately?? Please suggest.

2条回答
神经病院院长
2楼-- · 2019-08-01 08:49

Yes, there are a set of special characters that Firebase does not support in it's keys. From Firebase doc -

A child node's key cannot be longer than 768 bytes, nor deeper than 32 levels. It can include any unicode characters except for . $ # [ ] / and ASCII control characters 0-31 and 127.

You need to escape or encode those characters if they are present in your key. A simple character substitution encoding will work too.

查看更多
爷、活的狠高调
3楼-- · 2019-08-01 09:03

When you access the Firebase Database through its REST API, your URLs will end in .json. But aside from that, the . character is not allowed in Firebase Database paths. So node.special is not a valid node name.

查看更多
登录 后发表回答