diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -2591,10 +2591,6 @@ foreach ($need_upload as $key => $spec) { $change = $need_upload[$key]['change']; - $type = $spec['type']; - $size = strlen($spec['data']); - - $change->setMetadata("{$type}:file:size", $size); if ($spec['data'] === null) { // This covers the case where a file was added or removed; we don't // need to upload the other half of it (e.g., the old file data for @@ -2604,6 +2600,11 @@ continue; } + $type = $spec['type']; + $size = strlen($spec['data']); + + $change->setMetadata("{$type}:file:size", $size); + $mime = $this->getFileMimeType($spec['data']); if (preg_match('@^image/@', $mime)) { $change->setFileType($type_image);