[BUG] Lookup API dropped CGI escape of spaces in phone number values
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.4k
- Forks
- 472
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 5
Description
Describe the bug
In the latest (7.10.4) release the phone number value for validation no longer does CGI escaping of spaces which results in an error when validating a phone number with a space in it. This looks to be a recurring regression that has been patched in the past: https://github.com/twilio/twilio-ruby/pull/468
@uri = "/PhoneNumbers/#{CGI.escape(@solution[:phone_number]).gsub("+", "%20")}"
Code snippet
https://lookups.twilio.com/v1/PhoneNumbers/555 555 5555
Actual behavior
When given "555 555 5555" as a phone number value validation errors because of the spaces in the phone value now that the value is no longer CGI escaped.
Expected behavior
If given phone "555 555 5555" it should be possible to validate without error.
twilio-ruby version
7.10.3
Ruby version
3.3.2
Logs or error messages
bad URI(is not URI?): "https://lookups.twilio.com/v1/PhoneNumbers/555 555 5555"
Additional context
The value still containing spaces results in URI::InvalidURIError errors within Faraday's URI.parse() call when the URL looks like
https://lookups.twilio.com/v1/PhoneNumbers/555 555 5555
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/twilio-ruby/rest/lookups/v1/phone_number.rb around line 56 and compare it with the previous implementation linked in the issue. Reproduce the request using the phone number "555 555 5555" and verify that validation no longer raises URI::InvalidURIError when the URL is constructed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100