Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
  • Loading branch information
qweeah committed Sep 11, 2023
1 parent 706c468 commit dc3c297
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/oras/internal/option/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,14 @@ func (opts *Remote) NewRepository(reference string, common Common, logger logrus

// isPlainHttp returns the plain http flag for a given registry.
func (opts *Remote) isPlainHttp(registry string) bool {
if plainHTTP, enforced := opts.plainHTTP(); enforced {
plainHTTP, enforced := opts.plainHTTP()
if enforced {
return plainHTTP
}

// not specified, defaults to plain http for localhost
host, _, _ := net.SplitHostPort(registry)
return host == "localhost" || registry == "localhost"
if host == "localhost" || registry == "localhost" {
// not specified, defaults to plain http for localhost
return true
}
return plainHTTP
}

0 comments on commit dc3c297

Please sign in to comment.