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.

Files: 
CommentFileSizeAuthor
#1 1677010-Fixing_type_regeneration-2.patch417 bytespoedan
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1677010-Fixing_type_regeneration-2.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

poedan’s picture

StatusFileSize
new417 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1677010-Fixing_type_regeneration-2.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I check if the file type is already set.

Dave Reid’s picture

We should probably also check if (!empty($file->original) && $file->original->filemime != $file->filemime)) in case the file mime type has changed.

Dave Reid’s picture

We should probably also check if (!empty($file->original) && $file->original->filemime != $file->filemime)) in case the file mime type has changed.

Devin Carlson’s picture

Version:7.x-2.0-unstable6» 7.x-2.x-dev
Status:Active» Needs review

Status:Needs review» Needs work

The last submitted patch, 1677010-Fixing_type_regeneration-2.patch, failed testing.