Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295636

File Entity Always Gets File Size on Save

$
0
0

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


Viewing all articles
Browse latest Browse all 295636


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>