From a7b673b03a993d861d18dde2b815b810880abe71 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Wed, 17 Jul 2024 16:13:09 -0700 Subject: [PATCH] fix: don't update attribute mapping if nil --- internal/api/ssoadmin.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/api/ssoadmin.go b/internal/api/ssoadmin.go index 72d88dbac9..20fd8b9c5d 100644 --- a/internal/api/ssoadmin.go +++ b/internal/api/ssoadmin.go @@ -349,10 +349,13 @@ func (a *API) adminSSOProvidersUpdate(w http.ResponseWriter, r *http.Request) er } } - updateAttributeMapping := !provider.SAMLProvider.AttributeMapping.Equal(¶ms.AttributeMapping) - if updateAttributeMapping { - modified = true - provider.SAMLProvider.AttributeMapping = params.AttributeMapping + updateAttributeMapping := false + if params.AttributeMapping.Keys != nil { + updateAttributeMapping = !provider.SAMLProvider.AttributeMapping.Equal(¶ms.AttributeMapping) + if updateAttributeMapping { + modified = true + provider.SAMLProvider.AttributeMapping = params.AttributeMapping + } } nameIDFormat := ""