Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I wanted to make a migration and the hook_file_presave modified the type of the migrating file. We should modify the type only when it is empty.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1677010-Fixing_type_regeneration-2.patch | 417 bytes | poedan |
Comments
Comment #1
poedan CreditAttribution: poedan commentedI check if the file type is already set.
Comment #2
Dave ReidWe should probably also check
if (!empty($file->original) && $file->original->filemime != $file->filemime))
in case the file mime type has changed.Comment #3
Dave ReidWe should probably also check
if (!empty($file->original) && $file->original->filemime != $file->filemime))
in case the file mime type has changed.Comment #4
Devin Carlson CreditAttribution: Devin Carlson commentedComment #6
Heine CreditAttribution: Heine at LimoenGroen commentedThe suggestions appear to have been implemented elsewhere, at least in 7.x-2.0-beta2:
Please reopen if this is still an issue.