From 5fc401e199beab4003ac6fec41cefdf6db4da329 Mon Sep 17 00:00:00 2001 From: Honsun Zhu Date: Fri, 28 Nov 2025 15:56:57 +0800 Subject: [PATCH] fix: avoid Client slice field be null --- client/client.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/client/client.go b/client/client.go index 38ab42bd9ae..b67576ebbf0 100644 --- a/client/client.go +++ b/client/client.go @@ -407,6 +407,26 @@ func (c *Client) BeforeSave(_ *pop.Connection) error { c.AllowedCORSOrigins = sqlxx.StringSliceJSONFormat{} } + if c.Contacts == nil { + c.Contacts = sqlxx.StringSliceJSONFormat{} + } + + if c.PostLogoutRedirectURIs == nil { + c.PostLogoutRedirectURIs = sqlxx.StringSliceJSONFormat{} + } + + if c.RequestURIs == nil { + c.RequestURIs = sqlxx.StringSliceJSONFormat{} + } + + if c.GrantTypes == nil { + c.GrantTypes = sqlxx.StringSliceJSONFormat{} + } + + if c.ResponseTypes == nil { + c.ResponseTypes = sqlxx.StringSliceJSONFormat{} + } + if c.CreatedAt.IsZero() { c.CreatedAt = time.Now() }