- Issue was unassigned.
- Status changed to Closed: works as designed
over 1 year ago 2:44pm 16 February 2023 - π«π·France Grimreaper France π«π·
Hi,
I reproduce the "bug", but this is not related to Entity Share and the mentioned line.
In PhysicalFile.php:
$processed_entity->setFilename($this->fileSystem->basename($file_destination));
$processed_entity
is the file entity, not the media entity.This is due to core/modules/media/src/Entity/Media.php::prepareSave():
... if ($translation->hasField($entity_field_name) && ($translation->get($entity_field_name)->isEmpty() || $translation->hasSourceFieldChanged())) { $translation->set($entity_field_name, $media_source->getMetadata($translation, $metadata_attribute_name)); } ...
So this behavior happens the first time the media is imported on the client website or if the media source has changed. When reimporting, the correct name of the media is correctly present.
Maybe you can test the module https://www.drupal.org/project/media_name β which description let me think this is exactly the use case of the module.
Or see π Mapped media fields are overridden with metadata on translation save Needs work .