mirror of
https://github.com/rancher/norman.git
synced 2025-09-02 15:54:32 +00:00
workaround unimplementd ref validator
This commit is contained in:
committed by
Darren Shepherd
parent
8c0d4bfe2e
commit
df13831994
@@ -31,7 +31,7 @@ func ValidateAction(request *types.APIContext) (*types.Action, error) {
|
|||||||
return nil, httperror.NewAPIError(httperror.InvalidAction, fmt.Sprintf("Invalid action: %s", request.Action))
|
return nil, httperror.NewAPIError(httperror.InvalidAction, fmt.Sprintf("Invalid action: %s", request.Action))
|
||||||
}
|
}
|
||||||
|
|
||||||
if request.ID != "" {
|
if request.ID != "" && request.ReferenceValidator != nil {
|
||||||
resource := request.ReferenceValidator.Lookup(request.Type, request.ID)
|
resource := request.ReferenceValidator.Lookup(request.Type, request.ID)
|
||||||
if resource == nil {
|
if resource == nil {
|
||||||
return nil, httperror.NewAPIError(httperror.NotFound, fmt.Sprintf("Failed to find type: %s id: %s", request.Type, request.ID))
|
return nil, httperror.NewAPIError(httperror.NotFound, fmt.Sprintf("Failed to find type: %s id: %s", request.Type, request.ID))
|
||||||
|
Reference in New Issue
Block a user