Duplicate media for non-existing source image files

Created on 3 October 2023, about 1 year ago
Updated 4 October 2023, about 1 year ago

Problem/Motivation

If some of the image source files aren't exists or if to run the process on test environment where not all files are sync - then a sha1_file($file_uri) return FALSE and all such files are replaced with the same Media instance which isn't correct. Individual image Media instance should be generated even for the images which don't have a source file (which gonna works fine if files sync will be done later).

Steps to reproduce

  1. Remove files of some image field.
  2. Run the 'Clone to Media' process of the image field
  3. Check the new Media field values or Media content page
  4. Got the same Media ID usage for all fields where image source file were missed. In case if all source files missed - only one Image Media entity will be created.

Proposed resolution

The image_field_to_media_get_media_entity() process should check if the hash was successfully generated for the file uri. If not - we couldn't use array_search() for it.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine dmytro-aragorn Lutsk

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

Comments & Activities

Production build 0.71.5 2024