Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix cert encoding issues

Cert file reads were failing because they're UTF-8. This makes it
explicit.
  • Loading branch information...
commit 5ab5fb9506aec268861860bdffba583ada6837a2 1 parent 0033e63
@jbarnette authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/vines/store.rb
View
10 lib/vines/store.rb
@@ -43,10 +43,12 @@ def certs
unless @@sources
pattern = /-{5}BEGIN CERTIFICATE-{5}\n.*?-{5}END CERTIFICATE-{5}\n/m
pairs = Dir[File.join(@dir, '*.crt')].map do |name|
- pems = File.read(name).scan(pattern)
- certs = pems.map {|pem| OpenSSL::X509::Certificate.new(pem) }
- certs.reject! {|cert| cert.not_after < Time.now }
- [name, certs]
+ File.open(name, "r:UTF-8") do |f|
+ pems = f.read.scan(pattern)
+ certs = pems.map {|pem| OpenSSL::X509::Certificate.new(pem) }
+ certs.reject! {|cert| cert.not_after < Time.now }
+ [name, certs]
+ end
end
@@sources = Hash[pairs]
end
Please sign in to comment.
Something went wrong with that request. Please try again.