Media module treats default thumbnails as user content, allowing them to be lost when syncing files across environments

Created on 9 June 2019, over 5 years ago
Updated 27 March 2023, almost 2 years ago

Problem/Motivation

The media module’s hook_install() takes the default icons that ship with core and copies them to public://media-icons/generic (overridable in settings). By doing this, it immediately takes files that are shipped with core and typically checked into version control and places them into the files directory where user-generated content ends up and is not version-controlled.

If you are in the early stages of a site and have not yet created any content, you might assume that when moving the codebase and database to a new environment, you don't need to move the files directory since you have not created any content, but due to this behavior, that assumption is not true.

Are there other examples in Drupal core that operate in the way that media’s default icons do? In contrast, the image module ships with a sample.png (hot air balloons), and this image is not manipulated at all in image_install().

Steps to Reproduce

  1. Install Drupal.
  2. Enable Media module.
  3. Get database dump.
  4. Clone site in new environment.
  5. Import database.
  6. Skip transferring files directory because no content has been created.
  7. Media icons are missing.

Proposed resolution

Provide a way for the image module to fallback gracefully (or not need to) if the default icons are not found in the files directory.

πŸ› Bug report
Status

Active

Version

10.1 ✨

Component
MediaΒ  β†’

Last updated about 2 hours ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs framework manager review

    It is used to alert the framework manager core committer(s) that an issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy draft for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.

  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024