- Issue created by @ilyaukin
- First commit to issue fork.
- Merge request !44Fixes duplicate image names in public filesystem for data-media-id β (Open) created by Unnamed author
- π©πͺGermany harkonn
data-media-id
was missing for images in public filesystem, when the same test-image was uploaded in different months. This is more a problem for developing the tests while the end of a month occurs and you run the same tests in the same project. Deleting the media-entity is not enough, the files from the filesystem must be removed also.Explanation:
Drupal puts the test images in the public filesystem in a new folder for each month the test runs, examples:
- sites/default/files/2025-07/RobotsAtDesk.png
- sites/default/files/2025-07/RobotsAtDesk_0.png
- sites/default/files/2025-07/RobotsAtDesk_1.png
- sites/default/files/2025-08/RobotsAtDesk.png
- sites/default/files/2025-08/RobotsAtDesk_0.png
- sites/default/files/2025-08/RobotsAtDesk_1.pngThe hook
automated_testing_kit_preprocess_image
now finds two files for the same name with this code$file = \Drupal::entityTypeManager()->getStorage('file')->loadByProperties(['filename' => $filename]);
and so it doesn't setdata-media-id
.There may be more circumstances like the description of this issue says, my code fixes one source.