I'm trying to follow the examples laid out in the Firebase Security Rules for Cloud Storage Reference:
https://firebase.google.com/docs/reference/security/storage/
I copy & paste the example for split()
into my Storage Rules and it won't compile/let me save:
Splits a string according to a provided regular expression and returns a list of strings. Uses Google RE2 syntax.
// Allow files named "file.*" to be uploaded
match /{fileName} {
allow write: if fileName.split('.*\..*')[0] == 'file'
}
The error I get:
Unexpected '.'.
For the life of me, I can't get the example code provided to run, nor can I make changes and get Regex to work as expected.
Anyone have any suggestions for Allow files named "file.*" to be uploaded
?