TheDMSGroup / mautic-contact-client

Create custom integrations without writing code, like having your own Zapier.
GNU General Public License v3.0
95 stars 33 forks source link

[ENG-867] Trim field value before checking for empty/null #213

Closed westonwatson closed 5 years ago

westonwatson commented 5 years ago

Original Ticket/Request:

The situation is that we have required fields, but the evaluated tokens result in an empty " " (space) result, because there was a space between the tokens. The app considers this a valid value (because it's not completely empty) and thus doesn't mark that as missing a required field. When we mark a field as "required" that should mean that some non-empty whitespace character must exist there. Examples: "" - should be considered empty " " - should be considered empty " " - should be considered empty "0" - should NOT be considered empty " 0" - should NOT be considered empty "(anything else here)" - should NOT be considered empty

As you can see from the code change, simply trimming the value should remove the suspect empty space, causing a " " to get converted to "" triggering the existing "Required Field" exception.