How to access custom metadata in Firebase Security Rule for storage

Solution for How to access custom metadata in Firebase Security Rule for storage
is Given Below:

I’m stuck with an issue where I can’t find information. It seems like not a lot of people are using custom metadata with firebase and I can’t find clear documentation about it.

So, basically, what I’m doing is to give the file I’m uploading a new custom metadata that I called GroupID and in firebase security rule I’m checking that this GroupID is equal to something in the path of my file. Here is my rule :

rules_version = '2';
service {
  match /b/{bucket}/o {
    // Get/Set a challenge in storage
    match /Groups/{GroupID}/Challenges/{ChallengeType}/{PlayerID}/{File} {
      allow read: if request.auth.uid != null;
      allow write: if request.auth.uid == PlayerID
                   && request.resource.size < 25 * 1024 * 1024
                   && request.resource.metadata['GroupID'] == GroupID;

I was able to make sure that the issue comes from the last condition. I use all of these variants :

request.resource.metadata['GroupID'] == GroupID;
request.resource.metadata["GroupID"] == GroupID;
request.resource.metadata.GroupID == GroupID;
resource.metadata['GroupID'] == GroupID;
resource.metadata["GroupID"] == GroupID;
resource.metadata.GroupID == GroupID;

Also, I was able to make know that GroupID is a string while all metadata[‘GroupID’] and their variants are not a string. So the issue might comme from here.
However, when I’m creating the metadata in unity, they are created as string.

One last thing, using the simulator of Firebase Security Rules works.

You might need my unity side code for the metadata:

MetadataChange fileMetadata = new MetadataChange()
                CustomMetadata = new Dictionary<string, string>
                    { "GroupID" , group_ID },

So am I doing something wrong in C# or in the Firebase Security Rules?

Thanks in advance for you help !


EDIT 1 : I forgot but when I’m not checking metadata, I can put the file in firebase storage and metadata are here:

enter image description here