mosaic
mosaic copied to clipboard
Evaluate using toLowerCase in backend API code
A case mismatch between an email address in a spreadsheet (with the first letter capitalized) and an email address in the database (with the first letter not capitalized) led us to lowercase all of the emails addresses associated with an API request before comparing them to email addresses in the database.
This was a temporary solution, though. What should the long-term solution be?
Some options:
- Leave all emails alone and force the spreadsheet owners to make corrections if there's a mismatch.
- Use some sort of case-insensitive pattern matching on the backend like Postgres
ILIKE
.
What's wrong with toLowerCasing them?
email addresses are case-insensitive, right?
I agree that something like 2. seems a bit more principled that toLowerCase, but IDK that it really matters