Reputation: 4725
I'm trying to build a web app using FireBase backend and I have a storage rule as the following:
service firebase.storage {
match /b/stuff.appspot.com/o {
match /images/{fname}
{
allow read: if true;
allow write: if request.resource.md5hash != null;
}
}
}
However, when I try to put data to images/filename
, I'm getting a storage/unauthorized
error. If I remove the condition and set to just true
, it works as expected and therefore I think the request.resource.md5hash
is null.
What am I missing? Because I would expect any file to have a non-null md5 hash.
Additional notes:
md5Hash
in the client of the uploaded file. Therefore, a hash is actually being calculated at some point.md5hash
field is used, so it's expected to work.Upvotes: 0
Views: 466
Reputation: 15963
Two things:
md5Hash
(our reference docs are wrong, I just fixed them)md5Hash
is currently not being passed through to rules (yep, it's a bug, and we're fixing it now, though it takes some time to roll out to production)We're working on passing the MD5 through, so hold tight :)
Upvotes: 3