Problem/Motivation

Files are still set to "in use" even after the file is removed from the original content type. This makes it hard to remove the file through the normal Drupal clean up process.

Steps to reproduce

  1. Create site
  2. Enable `media` and `media library` modules
  3. Add new file field to `article` content type
  4. Create a new `article`, add a file and save it
  5. Edit new `article` by removing old file and adding a new one
  6. Go to /admin/content/files
  7. Verify that old files still shows in use

Proposed resolution

Since the content article no longer utilizes the file, it should reflect on the file usage as "0".

CommentFileSizeAuthor
step7.png58.94 KBjedgar1mx
step3.png6.14 KBjedgar1mx

Comments

jedgar1mx created an issue. See original summary.

cilefen’s picture

Thanks for taking the time to report a bug.

There are a lot of issues about file usage tracking, centered in #2821423: Dealing with unexpected file deletion due to incorrect file usage. Can you verify this issue is unique? If it is I will connect this issue to it.

jedgar1mx’s picture

Hi @cilefen, I looked in the issue queue for an issue that matched this problem but I didn't find it.

cilefen’s picture

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.