From 1791a6a2203f8f725c4a97754071da00dd38c55f Mon Sep 17 00:00:00 2001 From: Simon Esposito Date: Thu, 9 Nov 2023 17:48:54 +0000 Subject: [PATCH] Handle empty profile email when signing in with Apple --- server/core_authenticate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/core_authenticate.go b/server/core_authenticate.go index 8bc2285493..342be6d240 100644 --- a/server/core_authenticate.go +++ b/server/core_authenticate.go @@ -77,7 +77,7 @@ func AuthenticateApple(ctx context.Context, logger *zap.Logger, db *sql.DB, clie // Create a new account. userID := uuid.Must(uuid.NewV4()).String() - query = "INSERT INTO users (id, username, email, apple_id, create_time, update_time) VALUES ($1, $2, $3, $4, now(), now())" + query = "INSERT INTO users (id, username, email, apple_id, create_time, update_time) VALUES ($1, $2, NULLIF($3, ''), $4, now(), now())" result, err := db.ExecContext(ctx, query, userID, username, profile.Email, profile.ID) if err != nil { var pgErr *pgconn.PgError