Problem/Motivation

If adding/selecting media fails (e.g. due to a validation error), the module still renders the “Decorative” checkbox and an additional container intended for error output. In setups where another module (for example filehash) also provides an error message container, the same validation message can be displayed twice. This results in confusing and noisy error feedback for editors.

Steps to reproduce

  • Enable the module and add a media/image field that uses the widget where the “Decorative” checkbox is rendered.
  • Enable another module that adds validation errors for files (e.g. filehash / dedupe validation).
  • Try to add/upload a media item that triggers a validation error (so the file is not accepted/attached).
  • Observe that the validation error is rendered twice.

Proposed resolution

Only add/render the “Decorative” checkbox (and its wrapper/error container) when a file/media item was actually accepted and attached to the field widget. If the upload/selection fails and no valid file is present, the checkbox should not be rendered to avoid creating an extra error container and prevent duplicate error output.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gashunk created an issue. See original summary.

gashunk’s picture

Version: 1.3.3 » 1.x-dev
ll66382’s picture

Assigned: gashunk » ll66382

Thank you for identifying the issue, and for a proposed solution. I expect to test tomorrow or Saturday.

  • ll66382 committed 05553579 on 1.x
    Merge branch '3571199-prevent-duplicate-validation' into '1.x'
    
    Resolve...

ll66382’s picture

Assigned: ll66382 » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.