twurl
twurl copied to clipboard
twurl posting tweet errors with '&' escape
Describe the bug
Using Twitter API 1.1, the error occurs if option 'status' contains '&' in twurl CLI gem.
To Reproduce Steps to reproduce the behavior:
- Install twurl gem (0.9.6)
- Auth your Twitter application with twurl.
- Try a post command in the command line with
twurl -d 'status=bla-bla&foo&bar' /1.1/statuses/update.json
.
Expected behavior Post the tweet which contains '&'
Screenshots If applicable, add screenshots to help explain your problem.
twurl -d 'status=改行&テスト' /1.1/statuses/update.json
Traceback (most recent call last):
13: from ~/.rbenv/versions/2.6.2/bin/twurl:23:in `<main>'
12: from ~/.rbenv/versions/2.6.2/bin/twurl:23:in `load'
11: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/bin/twurl:4:in `<top (required)>'
10: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/cli.rb:21:in `run'
9: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/cli.rb:40:in `dispatch'
8: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/abstract_command_controller.rb:7:in `dispatch'
7: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/request_controller.rb:15:in `dispatch'
6: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/request_controller.rb:19:in `perform_request'
5: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/oauth_client.rb:181:in `perform_request_from_options'
4: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/oauth_client.rb:172:in `build_request_from_options'
3: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/oauth_client.rb:172:in `map'
2: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/oauth_client.rb:172:in `each'
1: from ~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/oauth_client.rb:173:in `block in build_request_from_options'
~/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/twurl-0.9.6/lib/twurl/oauth_client.rb:173:in `escape': no implicit conversion of nil into String (TypeError)
Desktop (please complete the following information):
- OS: MacOS 10.15.7 (Same thing happens in Github Actions with ruby v1 image, which is using ruby 2.7.2)
Smartphone (please complete the following information):
- No Smartphone environment has been through.
Additional context
Pretty much like the problem comes up due to the lines below...
https://github.com/twitter/twurl/blob/6c2f7bb69225d86e296b8bea94b3aaa4f63a2b87/lib/twurl/oauth_client.rb#L167-L176
This will be fixed in the coming new version: https://github.com/twitter/twurl/pull/161