Skip to content

WebformInheritTask does not correctly inherit files #338

Closed

Description

@jekuaitk

Summary

The WebformInherit-task does not correctly handle inheriting file-elements data.

Reproduce

  1. Create a Maestro flow with a WebformInherit-task that inherits an earlier submission.
  2. Add a file element, say document_file, with a limit of one file to both webforms.
  3. Open the inherit task and see in the logs that something went wrong.
Warning: foreach() argument must be of type array|object, string given in Drupal\file\Element\ManagedFile::valueCallback()

Cause

MaestroWebformInheritTask::webformSubmissionFormAlter() inherits submission data by setting default values. When a singular file is uploaded the submission data value is a string.

Default value expects an array, c.f. WebformManagedFileBase::setDefaultValue().

Fix

Cast to array when default value is being set on any type of file element.

Test

Same as reproduce but with different result:

  1. Create a Maestro flow with a WebformInherit-task that inherits an earlier submission.
  2. Add a file element, say document_file, with a limit of one file to both webforms.
  3. Open the inherit task and see that the file is correctly inherited.

Activity

  1. added theissue type on Jun 29, 2026
  2. ds-bellcom commented on Aug 25, 2026

    @ds-bellcom
    Contributor

    @OS2Forms/koordinationsgruppe som skrevet inde på #339, så estimerer vi 1 time til review på denne opgave.

  3. jekuaitk commented on Sep 15, 2026

    @jekuaitk
    ContributorAuthor

    @ds-bellcom This is superseded by #352. The change in the PR relating to that issue will inadvertently solve this issue!

  4. ds-bellcom commented on Sep 15, 2026

    @ds-bellcom
    Contributor

    @ds-bellcom This is superseded by #352. The change in the PR relating to that issue will inadvertently solve this issue!

    @jekuaitk eller @gBarlach vil I ikke lukke de issues og evt. PR, som ikke længere er aktuelle, således at vi kun har de issues der stadig er aktuelle tilbage?

  5. removed theissue type on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions