Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295813

Immediately delete a media's file when pressing 'Remove' in the media creation modal

$
0
0

Problem/Motivation

If you add an image via /media/add/image, you can click the "Remove" button after uploading a file, and the file you just uploaded is immediately deleted.

If you try to upload an image via the media library, you can click a "Remove" button for the item before you save it. However, when you do that, the file is not deleted right away. It is marked as temporary (there is pre-existing test coverage to confirm this), and therefore cleaned up at a later time by cron. This isn't necessary a major problem, but it's both inconsistent and a little more "lax", from a privacy standpoint, than the normal file field widget.

Steps to reproduce

  1. Add a media field to the article node type configured with the media library widget
  2. Create a new article
  3. Open the media library
  4. Upload a new image
  5. Click the 'Remove' button in the second step of the add form
  6. The media item is removed, the uploaded file however is still available on the server

Proposed resolution

Immediately delete a media item's associated file when pressing 'Remove' after uploading something in the media library.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

When adding items to the media library, uploaded files associated with unsaved media items are immediately deleted when the media items are removed.


Viewing all articles
Browse latest Browse all 295813

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>