Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ociregistry/ociauth/authfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "/")
Expand Down
4 changes: 2 additions & 2 deletions ociregistry/ociauth/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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<<k) == 0 {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion ociregistry/ociserver/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func parseRange(s string) ([]httpRange, error) {
return nil, errors.New("invalid range")
}
ranges := make([]httpRange, 0, 1)
for _, ra := range strings.Split(s[len(b):], ",") {
for ra := range strings.SplitSeq(s[len(b):], ",") {
ra = textproto.TrimString(ra)
if ra == "" {
continue
Expand Down