diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index aad914a43..2d69070e0 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -472,7 +472,7 @@ App::post('/v1/functions/:functionId/tags') } // Save to storage - $size ??= $device->getFileSize($fileTmpName); + $size ??= Storage::getDevice('self')->getFileSize($fileTmpName); $path = $device->getPath($tagId.'.'.\pathinfo($fileName, PATHINFO_EXTENSION)); $tag = $dbForInternal->getDocument('tags', $tagId); diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index d22802efd..3e4c053fd 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -616,13 +616,14 @@ App::post('/v1/storage/buckets/:bucketId/files') } $device = Storage::getDevice('files'); + $localDevice = Storage::getDevice('self'); if (!$upload->isValid($fileTmpName)) { throw new Exception('Invalid file', 403); } // Save to storage - $size ??= $device->getFileSize($fileTmpName); + $size ??= $localDevice->getFileSize($fileTmpName); $path = $device->getPath($fileId . '.' . \pathinfo($fileName, PATHINFO_EXTENSION)); $path = str_ireplace($device->getRoot(), $device->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); @@ -659,7 +660,7 @@ App::post('/v1/storage/buckets/:bucketId/files') } } - $mimeType = $device->getFileMimeType($path); // Get mime-type before compression and encryption + $mimeType = $localDevice->getFileMimeType($path); // Get mime-type before compression and encryption $data = ''; // Compression if ($size <= APP_STORAGE_READ_BUFFER) {