- Issue created by @godotislate
- Merge request !8Issue #3355468: Can not upload using core file upload element (no dropzonejs) because of false validation errors → (Open) created by godotislate
- Status changed to Needs review
almost 2 years ago 7:21pm 20 April 2023 Put in an MR for a new subclass of
Drupal\media_bulk_upload\Form\MediaBulkUploadForm
in the media_bulk_upload_dropzonejs submodule. MovedvalidateForm()
as well as the contents ofmedia_bulk_upload_dropzonejs_form_media_bulk_upload_form_alter()
to the new subclass, and altered the bulk upload route definition.- Status changed to RTBC
almost 2 years ago 12:15am 8 May 2023 - 🇳🇿New Zealand ericgsmith
Had the same issue after upgrading to 3.0.2.
Reviewed MR as at commit 06ea2f58ab7cb441440ff8303bfa2d6b551eae81 - looks good and resolves the issue when media_bulk_upload_dropzonejs is not enabled.
When media_bulk_upload_dropzonejs is enabled the MediaBulkUploadDropzoneJsForm form is used and validates as expected.
Attaching a patch file of godotislate's MR at 06ea2f58ab7cb441440ff8303bfa2d6b551eae81 for anybody that relies on a fixed point in time patch workflow. Thanks @godotislate!
- 🇳🇱Netherlands Eric_A
Wow, that's a lot of code to review... Is all that code strictly necessary to fix the critical regression or is it more of an improvement?
I'm wondering if we can just put back the DropzoneJS check that was removed in 🐛 Validation missing when empty bulk media upload form submitted Fixed . - 🇳🇱Netherlands Eric_A
I guess I'm too busy or too lazy to dive in right now.
But why does the early empty check in HEAD even trigger?
I'll dive in later... The only real new code is the route subscriber service in the media_bulk_upload_dropzonejs submodule. Otherwise, it's just moving code that was existing in the main module to the dropzonejs submodule, which really is where all things dropzonejs should go.
- 🇮🇳India kushal bansal
I faced the same issue in 3.0.2 and was able to resolve the same by enabling media_bulk_upload_dropzonejs and using https://unpkg.com/dropzone@5/dist/min/dropzone.min.js and https://unpkg.com/dropzone@5/dist/min/dropzone.min.css and placing them in libraries folder at libraries/dropzone/dist/min as new files dropzone.min.js and dropzone.min.css
- 🇮🇳India Sambit15
Patch file
media_bulk_upload-can-not-upload-using-core-element-3355468-06ea2f58.patchTested , and Verified Its working
This Issue is fixed - 🇺🇸United States tkiehne
Verified that the patch in #4 works and agree with the methodology: no dependent code should be in base module if the dependency isn't required.
- 🇬🇧United Kingdom the_g_bomb
Confirmed without dropzone this isn't working without the patch in from the MR or #4.
- 🇺🇸United States Kristen Pol Santa Cruz, CA, USA
Looking at creating a new release soon, so assigning to me.
Rebased to resolve the merge conflict.
Unrelated, but came up in testing against Drupal 11.1.3. The file validators need to be updated per https://www.drupal.org/node/3363700 → . So this section in
Drupal\media_bulk_upload\Form\MediaBulkUploadForm::buildForm()
:$validators = array( 'file_validate_extensions' => [implode(' ', $this->allowed_extensions)], 'file_validate_size' => [Bytes::toNumber($this->maxFileSizeForm)], );
needs to be
$validators = array( 'FileExtension' => ['extensions' => implode(' ', $this->allowed_extensions)], 'FileSizeLimit' => ['fileLimit' => Bytes::toNumber($this->maxFileSizeForm)], );
Also in media_bulk_upload_dropzonejs.module on latest 3.0.x (3ab898b1), this section in
media_bulk_upload_dropzonejs_form_media_bulk_upload_form_alter()
needs to be changed as well:if (isset($form['file_upload']['#upload_validators']['file_validate_extensions'][0])) { $form['file_upload']['#extensions'] = $form['file_upload']['#upload_validators']['file_validate_extensions'][0]; }
to
if (isset($form['file_upload']['#upload_validators']['FileExtension']['extensions'])) { $form['file_upload']['#extensions'] = $form['file_upload']['#upload_validators']['FileExtension']['extensions']; }
However, the contents of media_bulk_upload_dropzonejs_form_media_bulk_upload_form_alter() are moved to the new
MediaBulkUploadDropzoneJsForm
class in this MR, so the change would need be done in that class for this MR. The change to the validators for D11 compatibility seems to be out of scope for this issue, so if it's done in another issue, either the work there or work here will need to be rebased, depending on whichever is merged first.- 🇺🇸United States ben.hamelin Adirondack Mountains, NY
Noting that the MR diff does not apply cleanly to 3.0.2.
I had to use the patch from #4.
I could not get either approach to work (MBU form or DropzoneJS) without patch.
I also used "public://tmp" as my upload location (and created "tmp" folder in sites/default/files), and set Form Mode to "none"