英文:
is there a way to write Firsestore security rules for non-ASCII collection names?
问题
Many of my Firestore documents and collections are named in Arabic, but when I want to write security rules I noticed Arabic text is not accepted?
I need help on how to fix that?
I tried many types to write the Arabic collection names in the Security rules, but not accepted by Firebase and I couldn't find any useful solution on the Internet for this case.
英文:
Many of my Firestore documents and collections are named in Arabic, but when I want to write security rules I noticed Arabic text is not accepted?
I need help on how to fix that?
I tried many types to write the Arabic collection names in the Security rules, but not accepted by Firebase and I couldn't any useful solution on the Internet for this case.
答案1
得分: 2
以下是要翻译的内容:
firebaser here: I thought we'd covered this before, but can't find it - so I checked with the engineering team.
在您的规则定义中,路径段只能包含[A-Za-z0-9]
以及一些特殊字符,如*
和%
。对于其他字符,您应该使用十六进制/URL转义(使用%)。
所以,如果我有一个名为één
的集合,我会有一个匹配它的规则,如下所示:
match /%C3%A9%C3%A9n/{docid} {
allow read;
}
其中的%C3%A9%C3%A9n
是集合名称één
的URL编码,在这种情况下,通过执行encodeURI('één')
获取。
英文:
firebaser here: I thought we'd covered this before, but can't find it - so I checked with the engineering team.
The path segment in your rules definition may only contain [A-Za-z0-9]
plus some special characters like *
and %
. For other characters, you can should use hex/URL escaping (using %).
So if I have a collection named één, I'd have a rule matching it as:
match /%C3%A9%C3%A9n/{docid} {
allow read;
}
The %C3%A9%C3%A9n
in there is the URL encoding of the collection name één
, in this case gotten by doing encodeURI('één')
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论