diff --git a/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php b/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php index 949bdde28a..b4d1a23a3f 100644 --- a/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php +++ b/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php @@ -61,15 +61,20 @@ final class FileUploadChunkConduitAPIMethod $mime_type = 'application/octet-stream'; } + $params = array( + 'name' => $file->getMonogram().'.chunk-'.$chunk->getID(), + 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, + ); + + if ($mime_type !== null) { + $params['mime-type'] = 'application/octet-stream'; + } + // NOTE: These files have a view policy which prevents normal access. They // are only accessed through the storage engine. $chunk_data = PhabricatorFile::newFromFileData( $data, - array( - 'name' => $file->getMonogram().'.chunk-'.$chunk->getID(), - 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, - 'mime-type' => $mime_type, - )); + $params); $chunk->setDataFilePHID($chunk_data->getPHID())->save(); diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index 4faecbd557..db15fb43e0 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -251,6 +251,11 @@ final class PhabricatorFile extends PhabricatorFileDAO $file->setMimeType('application/octet-stream'); $chunked_hash = idx($params, 'chunkedHash'); + + // Get rid of this parameter now; we aren't passing it any further down + // the stack. + unset($params['chunkedHash']); + if ($chunked_hash) { $file->setContentHash($chunked_hash); } else {