Only set the filesize if it is not yet known on File->PreSave

Created on 25 January 2023, almost 2 years ago

Problem/Motivation

When bulk-generating file entities, like on a Drupal migration, many calls are made to get the file's metadata. However, some of this metadata might have already been provided by the generating process (in this case, a migrate script).

The `File->preSave()` method does not check if the filesize property has already been set/provided. This could be improved by first checking for the filesize before attempting to retrieve it; thus avoiding extra requests to the original resource, which might be a remote file, and save time.

Steps to reproduce

Proposed resolution

Only set the filesize if it is not yet known.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

10.1

Component
File system 

Last updated about 3 hours ago

Created by

🇨🇷Costa Rica esolano

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

Comments & Activities

Production build 0.71.5 2024