Problem/Motivation
File entities always get file size on save, even when the filesize attribute is manually set.
public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
$this->setSize(filesize($this->getFileUri()));
}
This forces Drupal to look up the file size upon migration (from Drupal 7), rather than using what is provided.
Proposed resolution
Check if the filesize attribute is already set before running the filesize method
Remaining tasks
Needs adding a check fort the filesize attribute on the preSave method
User interface changes
None
API changes
None
Data model changes
None