OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

OC with FileContentDefinitionStore stores definition with validation errors

Open lukaskabrt opened this issue 5 years ago • 0 comments

If the site uses FileContentDefinitionStore changes to the part definitions are saved even if the submited data isn't valid.

Steps to reproduce

  • create a content type with the List part (set a Page Size and select one Content type)
  • edit the List part (delete number from the Page Size field and select another Content type), click Save ** validation error is displayed, but Page size 0 and both selected Content types are saved to the .json file

If the site uses DatabaseContentDefinitionStore changes are voided by

if (!ModelState.IsValid)
{
    _session.Cancel();
    return View(viewModel);
}

in the AdminController, but the FileContentDefinitionStore stores changes imidietly.

Not sure how to fix this one. It isn't problem just for ListPart. Should all *PartSettingsDisplayDriver classes call context.Builder.WithSetting( ... ) only if context.Updater.ModelState.IsValid?

lukaskabrt avatar May 03 '19 13:05 lukaskabrt