diff --git a/ociregistry/ociauth/authfile.go b/ociregistry/ociauth/authfile.go index 0d4e898..ccf8150 100644 --- a/ociregistry/ociauth/authfile.go +++ b/ociregistry/ociauth/authfile.go @@ -289,10 +289,10 @@ func decodeConfigFile(data []byte) (configData, error) { // to keep the logic the same as that. func urlHost(url string) string { stripped := url - if strings.HasPrefix(url, "http://") { - stripped = strings.TrimPrefix(url, "http://") - } else if strings.HasPrefix(url, "https://") { - stripped = strings.TrimPrefix(url, "https://") + if after, ok := strings.CutPrefix(url, "http://"); ok { + stripped = after + } else if after, ok := strings.CutPrefix(url, "https://"); ok { + stripped = after } hostName, _, _ := strings.Cut(stripped, "/") diff --git a/ociregistry/ociauth/scope.go b/ociregistry/ociauth/scope.go index 6b37cd5..ccf95b1 100644 --- a/ociregistry/ociauth/scope.go +++ b/ociregistry/ociauth/scope.go @@ -143,7 +143,7 @@ func ParseScope(s string) Scope { }) continue } - for _, action := range strings.Split(parts[2], ",") { + for action := range strings.SplitSeq(parts[2], ",") { rscopes = append(rscopes, ResourceScope{ ResourceType: parts[0], Resource: parts[1], @@ -252,7 +252,7 @@ func (s Scope) Iter() func(yield func(ResourceScope) bool) { continue } acts := s.actions[i] - for k := knownAction(0); k < numActions; k++ { + for k := range numActions { if acts&(1<