I have the following rules for user post image uploads, however current rules don't allow file deletion.
How can I modify the rules to allow user to delete his pictures?
What property on request
variable indicates that a request is DELETE
?
match /{uid}/posts/{pid}/{imageName} {
allow read;
allow write: if (uid == request.auth.uid)
&& ((
((imageName == "pic.jpg") || (imageName == "pic.png") || (imageName == "pic.gif"))
&& (request.resource.size < 5 * 1024 * 1024)
&& (request.resource.contentType.matches('image/.*'))
));
}
Is there something like this?:
request.method == "DELETE"
I can't find anything in the documentation.
Found it:
request.resource == null
Hey, Firebase devs, this should be in the docs!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With