1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

Merge pull request #361 from akerouanton/fix-regressions-v0.9.0

[v0.9.0] osxkeychain: fix regressions on get and list
This commit is contained in:
Sebastiaan van Stijn
2025-02-28 12:51:02 +01:00
committed by GitHub
+10 -4
View File
@@ -117,8 +117,6 @@ func (h Osxkeychain) List() (map[string]string, error) {
default:
return nil, err
}
} else if len(res) == 0 {
return nil, credentials.NewErrCredentialsNotFound()
}
resp := make(map[string]string)
@@ -131,14 +129,22 @@ func (h Osxkeychain) List() (map[string]string, error) {
return resp, nil
}
const (
// Hardcoded protocol types matching their Objective-C equivalents.
// https://developer.apple.com/documentation/security/ksecattrprotocolhttps?language=objc
kSecProtocolTypeHTTPS = "htps" // This is NOT a typo.
// https://developer.apple.com/documentation/security/ksecattrprotocolhttp?language=objc
kSecProtocolTypeHTTP = "http"
)
func splitServer(serverURL string, item keychain.Item) error {
u, err := registryurl.Parse(serverURL)
if err != nil {
return err
}
item.SetProtocol("https")
item.SetProtocol(kSecProtocolTypeHTTPS)
if u.Scheme == "http" {
item.SetProtocol("http")
item.SetProtocol(kSecProtocolTypeHTTP)
}
item.SetServer(u.Hostname())
if p := u.Port(); p != "" {