瀏覽代碼

sanitize on load

Ajay Tripathy 5 年之前
父節點
當前提交
53a94e7633
共有 1 個文件被更改,包括 1 次插入1 次删除
  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 {
 		return c, err
 	}
-	cj = sanitizePolicy.SanitizeBytes(cj)
 	err = ioutil.WriteFile(pc.configPath, cj, 0644)
 
 	if err != nil {
@@ -191,6 +190,7 @@ func SetCustomPricingField(obj *CustomPricing, name string, value string) error
 	}
 
 	structFieldType := structFieldValue.Type()
+	value = sanitizePolicy.Sanitize(value)
 	val := reflect.ValueOf(value)
 	if structFieldType != val.Type() {
 		return fmt.Errorf("Provided value type didn't match custom pricing field type")