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
Issue fork dropzonejs_webform-3523696
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
Comment #3
mrweiner commentedThere 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.
Comment #5
lalop commentedThe PR is rebased
Comment #6
arno_vghThanks 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).
Comment #7
agoradesign commentedI haven't tried the patch from #6, but MR7 works great for us :)
Comment #8
arno_vgh