Make keys in GetMetadataProperties case-insensitive

This method is used by paths including the one that checks for Azure AD credentials. This makes the keys case-insensitive so the matching is more lenient (e.g. `azureClientId` vs `azureClientID`)

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
ItalyPaleAle 2023-01-24 09:07:15 -08:00
parent 7067334215
commit 254affd133
1 changed files with 5 additions and 1 deletions

View File

@ -125,8 +125,12 @@ func TryGetQueryIndexName(props map[string]string) (string, bool) {
// GetMetadataProperty returns a property from the metadata map, with support for aliases
func GetMetadataProperty(props map[string]string, keys ...string) (val string, ok bool) {
lcProps := make(map[string]string, len(props))
for k, v := range props {
lcProps[strings.ToLower(k)] = v
}
for _, k := range keys {
val, ok = props[k]
val, ok = lcProps[strings.ToLower(k)]
if ok {
return val, true
}