mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-10 22:25:39 +00:00
fix: handle null string form value for update contact form
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user