Drupal 9 core module media_library - more images selected than allowed limit

Created on 6 June 2024, 7 months ago
Updated 28 July 2024, 5 months ago

Module: Drupal 9 media_library
Here are the steps to reproduce issue:
1. For any content type, Create a media field allowing 1 image limit for the field.
2. Create new content and click 'Add Media', you can select only one image from existing library, which is correct
3. Click on 'Choose file' and upload new image, after upload new image is by default selected (Now more than one image is selected)
4. You can repeat step 3 again and again
5. Click on 'Insert Selected'

Expected result:
1. Should not allow multiple images to be uploaded
2. User should be able to delete extra images
3. Add Media button should not be available if uploaded count is equal to or greater than allowed

Actual result:
1. There are more images uploaded than allowed limit.
2. Shows negative count for remaining images.
3. Add Media' button still available to upload more images
4. If you try to remove extra images, it throws error and doesn't remove image.

Error: Call to a member function label() on null in Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::updateWidget() (line 703 of /var/www/html/motionCMS/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php)
💬 Support request
Status

Closed: outdated

Version

9.4

Component
Media 

Last updated about 11 hours ago

Created by

🇮🇳India nayanalok

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

Comments & Activities

Production build 0.71.5 2024