Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

More test cleanup #20

Merged
merged 1 commit into from

2 participants

@jbarnette

Fixes a cert file UTF-8 encoding issue.

@jbarnette jbarnette Fix cert encoding issues
Cert file reads were failing because they're UTF-8. This makes it
explicit.
5ab5fb9
@jbarnette

@dgraham Sounds like you're already on the other test failures, so I'm pulling the WIP tag off of this. Merge at your leisure. :)

@dgraham dgraham merged commit d26300b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 10, 2012
  1. @jbarnette

    Fix cert encoding issues

    jbarnette authored
    Cert file reads were failing because they're UTF-8. This makes it
    explicit.
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.