Skip to content

Commit

Permalink
Drop support for Ruby 1.9.2 in `Octokit::Client::Contents#create_cont…
Browse files Browse the repository at this point in the history
…ents`

The `#create_contents` method currently has code, added for
compatability ruby Ruby 1.9.2, which uses different `Base64`
methods depending on the Ruby version.

This removes that code, since we don't support 1.9.2 and
the `.strict_encode64` method has been present since 1.9.3.

Fixes #1433.
  • Loading branch information
timrogers committed Jun 8, 2022
1 parent 39c8f4a commit 4867c0f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/octokit/client/contents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ def create_contents(*args)
end
raise ArgumentError, 'content or :file option required' if content.nil?

options[:content] = Base64.respond_to?(:strict_encode64) ?
Base64.strict_encode64(content) :
Base64.encode64(content).delete("\n") # Ruby 1.9.2
options[:content] = Base64.strict_encode64(content)
options[:message] = message
url = "#{Repository.path repo}/contents/#{path}"
put url, options
Expand Down

0 comments on commit 4867c0f

Please sign in to comment.