Skip to content

Commit

Permalink
URI.open does not exist before Ruby 2.5
Browse files Browse the repository at this point in the history
Refs. #2462
  • Loading branch information
mshibuya committed Oct 5, 2020
1 parent ac3d006 commit 8228e1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/carrierwave/uploader/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def file
headers = @remote_headers.
reverse_merge('User-Agent' => "CarrierWave/#{CarrierWave::VERSION}")

@file = URI.open(@uri.to_s, headers)
@file = (URI.respond_to?(:open) ? URI : Kernel).open(@uri.to_s, headers)
@file = @file.is_a?(String) ? StringIO.new(@file) : @file
end
@file
Expand Down

0 comments on commit 8228e1b

Please sign in to comment.