Media is hidden when directory is deleted

Created on 7 May 2025, about 1 month ago

Problem/Motivation

Did not find any issues regarding this. Please close this if this is a duplicate.

If a directory/term is deleted, all the images become unreachable via Drupal Media view (/admin/content/media). Tested with Media Directories UI.

Digging the database reveals that the reference is not deleted from the media.

Steps to reproduce

  1. Install, enable and configure module like normally
  2. Create a term/directory
  3. Edit image and select newly created directory
  4. Confirm you see it correctly when filtering directory in /admin/content/media
  5. Delete the term/directory
  6. Confirm the image is not shown in /admin/content/media when selecting "Root directory"

Proposed resolution

Add a process to go through the media items having the deleted directory/term ID in database table `media_field_data` column `directory` and set this value to `NULL` when taxonomy term/directory is deleted.

🐛 Bug report
Status

Active

Version

2.2

Component

Code

Created by

🇫🇮Finland ronttizz Helsinki

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

Comments & Activities

Production build 0.71.5 2024