mirror of
https://github.com/rancher/norman.git
synced 2025-09-05 01:00:36 +00:00
Allow types that start with cluster or project
This commit is contained in:
@@ -142,7 +142,11 @@ func versionsForPath(schemas *types.Schemas, path string) []types.APIVersion {
|
|||||||
var matchedVersion []types.APIVersion
|
var matchedVersion []types.APIVersion
|
||||||
for _, version := range schemas.Versions() {
|
for _, version := range schemas.Versions() {
|
||||||
if strings.HasPrefix(path, version.Path) {
|
if strings.HasPrefix(path, version.Path) {
|
||||||
matchedVersion = append(matchedVersion, version)
|
afterPath := path[len(version.Path):]
|
||||||
|
// if version.Path is /v3/cluster allow /v3/clusters but not /v3/clusterstuff
|
||||||
|
if len(afterPath) < 3 || strings.Contains(afterPath[:3], "/") {
|
||||||
|
matchedVersion = append(matchedVersion, version)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.Slice(matchedVersion, func(i, j int) bool {
|
sort.Slice(matchedVersion, func(i, j int) bool {
|
||||||
|
Reference in New Issue
Block a user