我正在尝试在Firebase存储中上传图片。我一直关注Firebase Storage Tutorial上传图片。如网站所述,我必须更改默认的存储规则。所以,我把规则改为:
$should = [];
if ($request->brand) {
$should[] = ['match' => ['brand' => $request->brand]];
}
if ($request->year) {
$should[] = ['match' => ['year' => $request->year]];
}
if ($request->item) {
$should[] = ['match' => ['item' => $request->item]];
}
// ...
$this->elasticParams['body'] = [
'query' => [
'bool' => [
'should' => $should
]
]
];
当我尝试发布规则时,我收到以下错误:
service firebase.storage {
match /b/fir-storage-42411.firebaseio.com/o {
match /{allPaths=**} {
allow read, write: if true;
}
}
}
试图谷歌错误,但找不到任何结果。
感谢。
答案 0 :(得分:2)
我看到的明显错误是您的规则应该引用您的存储桶(fir-storage-42411.appspot.com
),而不是您的数据库(fir-storage-42411.firebaseio.com
)。除此之外,这应该是有效的(除非可能隐藏在那里的任何隐藏的特殊字符):
service firebase.storage {
match /b/fir-storage-42411.appspot.com/o {
match /{allPaths=**} {
allow read, write;
}
}
}