File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
lib/imagekit/internal/transport Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ # frozen_string_literal: true
3+ # typed: strong
4+
5+ require_relative "../lib/imagekit"
6+
7+ client = Imagekit ::Client . new (
8+ private_key : ENV . fetch ( "IMAGEKIT_PRIVATE_KEY" , nil )
9+ )
10+
11+ begin
12+ response = client . files . upload (
13+ file : "https://www.example.com/public-url.jpg" ,
14+ file_name : "file-name.jpg"
15+ )
16+
17+ pp ( response )
18+ end
Original file line number Diff line number Diff line change @@ -33,6 +33,19 @@ def connect(url)
3333 Net ::HTTP . new ( url . host , port ) . tap do
3434 _1 . use_ssl = %w[ https wss ] . include? ( url . scheme )
3535 _1 . max_retries = 0
36+
37+ # Temporary workaround for SSL verification issue on some
38+ # platforms. Similar to: https://github.com/stripe/stripe-ruby/pull/397
39+ # Without this fix you may see errors like:
40+ # .rbenv/versions/3.2.0/lib/ruby/3.2.0/net/protocol.rb:46:in `connect_nonblock':
41+ # SSL_connect returned=1 errno=0 peeraddr=52.23.130.57:443 state=error:
42+ # certificate verify failed (unable to get certificate CRL) (OpenSSL::SSL::SSLError)
43+ if _1 . use_ssl?
44+ cert_store = OpenSSL ::X509 ::Store . new
45+ cert_store . set_default_paths
46+ _1 . cert_store = cert_store
47+ _1 . verify_mode = OpenSSL ::SSL ::VERIFY_PEER
48+ end
3649 end
3750 end
3851
You can’t perform that action at this time.
0 commit comments