fix(16.2): WR-06 hand a translatable Decode only strings
liftMLValues validated only object-shaped submissions, so a scalar submitted for a translatable plugin field reached Decode as nil, a float64 or a bool although pact promises a string; a type that asserts a string panicked into an opaque 500. decodePluginFields now passes a string through, turns null into the empty string and refuses any other value with a 422 on the field before Decode runs.
This commit is contained in:
@@ -416,7 +416,9 @@ type FormFieldType struct {
|
||||
// translatable type and empty otherwise; Default is true when the value lives
|
||||
// in the host column (always true for a type that is not translatable). Value
|
||||
// is the submitted value (Decode) or the stored value (Load); it is a string
|
||||
// for a translatable type and any JSON value otherwise. Translated, when set,
|
||||
// for a translatable type (the framework refuses any other submitted value,
|
||||
// null aside, which is the empty string, before Decode runs) and any JSON
|
||||
// value otherwise. Translated, when set,
|
||||
// reads another attribute of Record in Locale exactly, without fallback; it is
|
||||
// nil for a type that is not translatable and when no translation writer is
|
||||
// published.
|
||||
|
||||
Reference in New Issue
Block a user