fix: handle null string form value for update contact form

This commit is contained in:
Abhinav Raut
2025-04-15 03:45:45 +05:30
parent 971a433f3d
commit 450b609d47
+11
View File
@@ -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)