首页 > 解决方案 > Firebase 存储安全规则中有哪些不同类型的匹配?

问题描述

Firebase 存储安全规则中有哪些不同类型的匹配?如何匹配安全规则中的路径似乎非常令人困惑。请帮忙。谢谢!

标签: firebasefirebase-realtime-databasefirebase-authenticationfirebase-storagefirebase-security

解决方案


在 firebase 存储安全规则中,"match"是一个关键字。 "match"用于匹配特定的存储路径,以便您可以将规则应用于该位置。每条路径都以'/'路径段开头。

有 3 种类型的路径段:

  1. 单段:引用特定文件。语法 - match /images/profile.png (仅匹配 /images/profile.png)
  2. 单段通配符:引用特定路径级别的所有路径。语法 - match /images/{images} (匹配 /images/xyz.png,但不匹配 /images/screenshots/xyz.png)
  3. 多段通配符:引用特定路径处或下方的所有路径。语法 - match /images/{images=**} (匹配 /images/xyz.png,也匹配 /images/screenshots/xyz.png)

希望能帮助到你。

更多信息参考


推荐阅读