diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index f83da8e590..acb57ccafa 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -581,7 +581,7 @@ App::post('/v1/storage/buckets/:bucketId/files') $size = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; $contentRange = $request->getHeader('content-range'); - $fileId = $fileId == 'unique()' ? $dbForInternal->getId() : $fileId; + $fileId = $fileId === 'unique()' ? $dbForInternal->getId() : $fileId; $chunk = 1; $chunks = 1; @@ -594,7 +594,7 @@ App::post('/v1/storage/buckets/:bucketId/files') throw new Exception('Invalid content-range header', 400); } - if ($end == $size) { + if ($end === $size) { //if it's a last chunks the chunk size might differ, so we set the $chunks and $chunk to notify it's last chunk $chunks = $chunk = -1; } else { @@ -622,13 +622,13 @@ App::post('/v1/storage/buckets/:bucketId/files') // Save to storage $size ??= $device->getFileSize($fileTmpName); $path = $device->getPath($fileId . '.' . \pathinfo($fileName, PATHINFO_EXTENSION)); - $path = str_ireplace($device->getRoot(), $device->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); + $path = str_ireplace($device->getRoot(), $device->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); // Add bucket id to path after root $file = $dbForInternal->getDocument('bucket_' . $bucketId, $fileId); if (!$file->isEmpty()) { $chunks = $file->getAttribute('chunksTotal', 1); - if ($chunk == -1) { + if ($chunk === -1) { $chunk = $chunks; } } @@ -640,7 +640,7 @@ App::post('/v1/storage/buckets/:bucketId/files') $read = (is_null($read) && !$user->isEmpty()) ? ['user:' . $user->getId()] : $read ?? []; $write = (is_null($write) && !$user->isEmpty()) ? ['user:' . $user->getId()] : $write ?? []; - if ($chunksUploaded == $chunks) { + if ($chunksUploaded === $chunks) { if (App::getEnv('_APP_STORAGE_ANTIVIRUS') === 'enabled' && $bucket->getAttribute('antiVirus', true) && $size <= APP_LIMIT_ANTIVIRUS) { $antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), (int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));