firebase - Firebase 存储大小限制未强制执行
问题描述
您好,我对文件夹 /posts/media/{userId}/{media} 有如下规则:
service firebase.storage {
match /b/{bucket}/o {
match /{allPath=**} {
allow read, create, write;
}
match /posts/media {
allow create: if request.auth != null && request.resource.size < 10 * 1024 * 1024
&& request.resource.contentType.matches('(image|video)/.*');
match /{userId}/{allPaths=**} {
allow create, write: if request.auth.uid == userId && request.resource.size < 10 * 1024 * 1024
&& request.resource.contentType.matches('(image|video)/.*');
}
}
}
}
不强制使用 10MB 的文件大小。用户可以轻松发布数倍于 10MB 限制的视频。
有什么帮助吗?
谢谢你,米歇尔
解决方案
此规则允许对整个存储桶进行不受限制的读写访问:
match /{allPath=**} {
allow read, create, write;
}
如果您不想要这种行为,请删除该规则。它的许可性将凌驾于所有其他规则之上。您不能缩小其他规则授予的访问范围。如果任何规则允许访问文件,则不能被其他规则更改。
推荐阅读
- asp.net - 我有 web.config 文件。我也想将我制定的 url 规则应用于子文件夹。该代码仅在根目录中有效
- php - WordPress SQL 按用户角色获取特定用户
- c - 具有交替彩色行的半金字塔
- powerbi - POWER BI 对所有值求和,但仅在最后一个日期显示
- identityserver4 - IdentityServer4 一分钟后不断取消令牌请求
- json - electron-builder 生成 latest.json 而不是 latest.yml
- javascript - 未选中复选框时从数组中删除项目在反应中未按预期工作
- r - 有没有办法在 R 中的数据间隙之间对列中的值进行分组?
- java - 具有非字符串类型过滤器的条件查询 - JPA/Hibernate Spring Boot
- jasperserver - Jasper 报告服务器中的 AdHoc 缓存