Selaa lähdekoodia

sanitize on load

Ajay Tripathy 5 vuotta sitten
vanhempi
sitoutus
53a94e7633
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      pkg/cloud/providerconfig.go

+ 1 - 1
pkg/cloud/providerconfig.go

@@ -125,7 +125,6 @@ func (pc *ProviderConfig) Update(updateFunc func(*CustomPricing) error) (*Custom
 	if err != nil {
 	if err != nil {
 		return c, err
 		return c, err
 	}
 	}
-	cj = sanitizePolicy.SanitizeBytes(cj)
 	err = ioutil.WriteFile(pc.configPath, cj, 0644)
 	err = ioutil.WriteFile(pc.configPath, cj, 0644)
 
 
 	if err != nil {
 	if err != nil {
@@ -191,6 +190,7 @@ func SetCustomPricingField(obj *CustomPricing, name string, value string) error
 	}
 	}
 
 
 	structFieldType := structFieldValue.Type()
 	structFieldType := structFieldValue.Type()
+	value = sanitizePolicy.Sanitize(value)
 	val := reflect.ValueOf(value)
 	val := reflect.ValueOf(value)
 	if structFieldType != val.Type() {
 	if structFieldType != val.Type() {
 		return fmt.Errorf("Provided value type didn't match custom pricing field type")
 		return fmt.Errorf("Provided value type didn't match custom pricing field type")