Skip to content

Commit aee9731

Browse files
authored
Merge pull request #84 from eunomie/auth
convert to hostname if needed when trying to authenticate
2 parents 75ab1e3 + 84da157 commit aee9731

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Gopkg.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

remotes/push.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"io"
99
"os"
1010

11+
"github.com/docker/cli/cli/config/credentials"
12+
1113
"github.com/docker/cnab-to-oci/internal"
1214

1315
"github.com/docker/cli/cli/config"
@@ -291,8 +293,16 @@ func resolveAuthConfig(index *registrytypes.IndexInfo) configtypes.AuthConfig {
291293
return configtypes.AuthConfig{}
292294
}
293295

296+
// See https://github.com/docker/cli/blob/23446275646041f9b598d64c51be24d5d0e49376/cli/config/credentials/file_store.go#L32-L47
297+
// We are looking for the hostname in the configuration, and if not we are trying with a pure hostname (so without
298+
// http/https).
294299
authConfig, ok := configs[hostName]
295300
if !ok {
301+
for reg, config := range configs {
302+
if hostName == credentials.ConvertToHostname(reg) {
303+
return config
304+
}
305+
}
296306
return configtypes.AuthConfig{}
297307
}
298308
return authConfig

0 commit comments

Comments
 (0)