Ensure that dropzonejs properly validates uploads before creating a file/media entity

Created on 12 January 2023, over 1 year ago
Updated 4 May 2023, about 1 year ago

Problem/Motivation

While trying to test with the clamav β†’ module, I realized that the files uploaded via the media_bulk_upload_dropzonejs submodule do not carry out the necessary file validations during uploads before creating a File entity, this shouldn't be the case.

Steps to reproduce

  • Enable the media_bulk_upload_dropzonejs submodule
  • Enable clamav with an invalid scan mechanism and "Block unchecked files" ticked. Or alternatively implement the hook_file_validate hook and always have it return an error.

Proposed resolution

Make use of existing APIs to create a valid file entity.

Borrowing from existing Dropzone module examples or how core handles file uploads via file_save_upload with the FileUploadHandler service.

Remaining tasks

User interface changes

N/A

API changes

Added new array context containing the following to the hook_media_bulk_upload_file_ids_alter hook:
- media_bulk_upload_form: the current MediaBulkUploadForm instance.
- form: the current form array.
- form_state: the current form state.
- media_bulk_config: the Media Bulk Config entity.

Data model changes

N/A

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024