From 450b609d47b33ffb9b968ddbfee2e982d43c893d Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Tue, 15 Apr 2025 03:45:45 +0530 Subject: [PATCH] fix: handle `null` string form value for update contact form --- cmd/contacts.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/contacts.go b/cmd/contacts.go index 756cbd42..1c93367c 100644 --- a/cmd/contacts.go +++ b/cmd/contacts.go @@ -104,6 +104,17 @@ func handleUpdateContact(r *fastglue.Request) error { avatarURL = string(v[0]) } + // Set nulls to empty strings. + if avatarURL == "null" { + avatarURL = "" + } + if phoneNumberCallingCode == "null" { + phoneNumberCallingCode = "" + } + if phoneNumber == "null" { + phoneNumber = "" + } + // Validate mandatory fields. if email == "" { return r.SendErrorEnvelope(fasthttp.StatusBadRequest, app.i18n.Ts("globals.messages.empty", "name", "email"), nil, envelope.InputError)