fix: defensively handle nil maps and slices in marshaling (#18418)

Adds a custom marshaler to handle some cases where nils were being
marshaled to nulls, causing the web UI to throw an error.

---------

Co-authored-by: Steven Masley <stevenmasley@gmail.com>
This commit is contained in:
Charlie Voiselle
2025-06-17 17:50:18 -04:00
committed by GitHub
parent 9cbe02e8b7
commit 44d46469e1
5 changed files with 80 additions and 0 deletions

View File

@ -836,6 +836,9 @@ func (api *API) idpSyncClaimFieldValues(orgID uuid.UUID, rw http.ResponseWriter,
httpapi.InternalServerError(rw, err)
return
}
if fieldValues == nil {
fieldValues = []string{}
}
httpapi.Write(ctx, rw, http.StatusOK, fieldValues)
}