cozy / cozy-contacts-v2

Contact books manager for Cozy
http://cozy.io
GNU Affero General Public License v3.0
20 stars 20 forks source link

Prevent Fuzzy to call toLowerCase() on non-string object #294

Closed gregorylegarec closed 7 years ago

gregorylegarec commented 7 years ago

This PR is supposed to fix #259

This issue seems to occur when Fuzzy.match is called with a non string parameter as target.

I was not able to reproduce it manually so I forced the behavior by editing the line https://github.com/cozy/cozy-contacts/blob/master/client/app/models/contact.coffee#L172 to

        targets = _.compact [@toString(), @attributes.org, {test:'not a string'}]

It threw the exact same error.

Thanks @m4dz to have a review.