Since 10.1 you can always upload multiple files even if only one is expected

Created on 1 August 2024, 9 months ago

Problem/Motivation

Since https://git.drupalcode.org/project/drupal/-/commit/ae4b7247b81d5197ae3d6...
Also in 10.1

It means that even if cardinality of the target media library field is 1 it will allow multiple files to be uploaded - but will validate that only one is selected at the end.

However, Dropzone is then allowing now as many files as needed to be uploaded, and so you end up with a "33 of 1" items selected and then validation error. Ideally Dropzone would only allow 1 file to be uploaded.

Steps to reproduce

1. Setup media library widget on a media reference field on a content type
2. When creating new content, select add media
3. See that the drop zone says Select files but underneath it says "One file only"
4. Drag in 10 files
5. After upload note that it says "10 of 1" selected and you cannot submit

Proposed resolution

Obey the correct cardinality value from the media library state "slots available" value.

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Active

Version

2.10

Component

Code

Created by

🇬🇧United Kingdom Driskell

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

Comments & Activities

Production build 0.71.5 2024