fix api to account for non-local storage
This commit is contained in:
parent
436f6b7c77
commit
c9595b40dd
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue