MCPcopy
hub / github.com/git-lfs/git-lfs / appendCertsFromFile

Function appendCertsFromFile

lfshttp/certs.go:176–192  ·  view source on GitHub ↗
(pool *x509.CertPool, filename string)

Source from the content-addressed store, hash-verified

174}
175
176func appendCertsFromFile(pool *x509.CertPool, filename string) *x509.CertPool {
177 filenamepath, errfile := tools.TranslateCygwinPath(filename)
178 if errfile != nil {
179 tracerx.Printf("Error reading cert dir %q: %v", filenamepath, errfile)
180 }
181 data, err := os.ReadFile(filenamepath)
182 if err != nil {
183 tracerx.Printf("Error reading cert file %q: %v", filename, err)
184 return pool
185 }
186 // Firstly, try parsing as binary certificate
187 if certs, err := x509.ParseCertificates(data); err == nil {
188 return appendCerts(pool, certs)
189 }
190 // If not binary certs, try PEM data
191 return appendCertsFromPEMData(pool, data)
192}
193
194func appendCerts(pool *x509.CertPool, certs []*x509.Certificate) *x509.CertPool {
195 if len(certs) == 0 {

Callers 2

Calls 3

TranslateCygwinPathFunction · 0.92
appendCertsFunction · 0.85
appendCertsFromPEMDataFunction · 0.85

Tested by

no test coverage detected