File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,18 @@ import (
1313)
1414
1515// ReadCertPool loads a certificate pool from disk.
16+ // *path*: a file, a directory, or a comma-separated list of files.
1617func ReadCertPool (path string ) (* realx509.CertPool , error ) {
1718 info , err := os .Stat (path )
18- if err != nil {
19- return nil , errors .WithStack (err )
19+ if err != nil && ! os . IsNotExist ( err ) {
20+ return nil , errors .Wrapf (err , "os.Stat %s failed" , path )
2021 }
2122
2223 var (
2324 files []string
2425 pool = realx509 .NewCertPool ()
2526 )
26- if info .IsDir () {
27+ if info != nil && info .IsDir () {
2728 finfos , err := ioutil .ReadDir (path )
2829 if err != nil {
2930 return nil , errs .FileError (err , path )
@@ -33,6 +34,9 @@ func ReadCertPool(path string) (*realx509.CertPool, error) {
3334 }
3435 } else {
3536 files = strings .Split (path , "," )
37+ for i := range files {
38+ files [i ] = strings .TrimSpace (files [i ])
39+ }
3640 }
3741
3842 var pems []byte
You can’t perform that action at this time.
0 commit comments