1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-08 10:39:17 +00:00

remove the checks on some return values, which was added recently by another PR, to make it work when being used in rancher

This commit is contained in:
Jiaqi Luo
2022-12-02 20:27:19 -07:00
parent c943439888
commit 29dae41a91
2 changed files with 3 additions and 9 deletions

View File

@@ -293,10 +293,7 @@ func parseAction(url *url.URL) (string, string) {
} }
func Body(req *http.Request) (map[string]interface{}, error) { func Body(req *http.Request) (map[string]interface{}, error) {
err := req.ParseMultipartForm(maxFormSize) _ = req.ParseMultipartForm(maxFormSize)
if err != nil {
return nil, err
}
if req.MultipartForm != nil { if req.MultipartForm != nil {
return valuesToBody(req.MultipartForm.Value), nil return valuesToBody(req.MultipartForm.Value), nil
} }

View File

@@ -2,7 +2,6 @@ package mapper
import ( import (
"fmt" "fmt"
"strings" "strings"
"github.com/rancher/norman/types" "github.com/rancher/norman/types"
@@ -39,13 +38,11 @@ func (m Move) ModifySchema(s *types.Schema, schemas *types.Schemas) error {
return fmt.Errorf("failed to find field %s on schema %s", m.From, s.ID) return fmt.Errorf("failed to find field %s on schema %s", m.From, s.ID)
} }
toSchema, toFieldName, _, ok, err := getField(s, schemas, m.To) toSchema, toFieldName, _, _, err := getField(s, schemas, m.To)
if err != nil { if err != nil {
return err return err
} }
if !ok {
return fmt.Errorf("failed to find field %s on schema %s", m.To, s.ID)
}
_, ok = toSchema.ResourceFields[toFieldName] _, ok = toSchema.ResourceFields[toFieldName]
if ok && !strings.Contains(m.To, "/") && !m.DestDefined { if ok && !strings.Contains(m.To, "/") && !m.DestDefined {
return fmt.Errorf("field %s already exists on schema %s", m.To, s.ID) return fmt.Errorf("field %s already exists on schema %s", m.To, s.ID)