Problem/Motivation

The Drupal\webform_dropzonejs\Element\WebformDropzonejs::preRenderDropzoneJs uses $element['#extensions'] = $element['#upload_validators']['file_validate_extensions'][0] ?? ''; to determine valid file extensions. This doesn't seem to be valid anymore in newer versions of webform/Drupal.

https://www.drupal.org/project/webform/issues/3465838 handles this as follows:

-    $validators = ['file_validate_extensions' => ['csv']];
+    $validators = ['FileExtension' => ['extensions' => 'csv']];

We need to do the same.

Steps to reproduce

Update to a recent version of core/webform and try to drag and drop to upload a file. Upload fails no matter what the file type is. Futher, clicking "select files" doesn't even allow selection of any files because it thinks there are no valid extensions.

Proposed resolution

Update extension validation.

Remaining tasks

update extensions validation

User interface changes

none

API changes

none

Data model changes

none

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

mrweiner created an issue. See original summary.

mrweiner’s picture

Status: Active » Needs review

There are issues with the MR because 1.0.x is somehow behind 1.0.3. But this is a one-line change so should apply cleanly.

lalop made their first commit to this issue’s fork.

lalop’s picture

The PR is rebased

arno_vgh’s picture

Thanks for the MR it works with the default version.
This patch resolves the issue when using version 1.0.3 in combination with the chunked file upload support introduced in issue #3549965. This is based on the code shared in comment #11 on #3499051).

agoradesign’s picture

Status: Needs review » Reviewed & tested by the community

I haven't tried the patch from #6, but MR7 works great for us :)

arno_vgh’s picture

Status: Reviewed & tested by the community » 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.