-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plausible_number? is far too permissive #204
Comments
Any suggested fix? Open to pull requests.
…On Thu, Jan 28, 2021, 12:19 Chris Howlett ***@***.***> wrote:
Because normalize_number strips all non-phonelike characters from its
input, you get weird results like the following:
PhonyRails.plausible_number?('https://doi.org/10.1002/rse2.195', country_code: 'GB')
# => true
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#204>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAWKSXCSGCAALXLXJFVJDTS4FB2PANCNFSM4WW4E3AA>
.
|
Well, it depends on what you, as owner, want the behaviour to be. I see that you strip any non-(digit, bracket or plus), and I can see that stripping dashes from +44-1234-567-890 (for instance) makes sense. Letters feel like they're less likely to appear in a valid number (especially since extensions are dealt with earlier). Perhaps it should strip all non-phonelike, non-alphabetic characters? |
@joost I want to try and submit a pull request, but I can't get tests running. I've:
I get the following error output:
My Gemfile.lock now looks like this:
|
Hi @asilano! I see things broke when using |
Please see the https://github.com/joost/phony_rails/tree/no_mongoid branch for a version with working specs. Pull request welcome! |
Thanks, the branch works nicely. Unfortunately, my fix doesn't - I'll have a think, and maybe I'll go bother them too :) |
Because
normalize_number
strips all non-phonelike characters from its input, you get weird results like the following:The text was updated successfully, but these errors were encountered: