diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php
index 6b077d972f..7eb55485e0 100644
--- a/app/controllers/api/storage.php
+++ b/app/controllers/api/storage.php
@@ -864,7 +864,8 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
->inject('usage')
->inject('mode')
->inject('deviceFiles')
- ->action(function ($bucketId, $fileId, $width, $height, $gravity, $quality, $borderWidth, $borderColor, $borderRadius, $opacity, $rotation, $background, $output, $request, $response, $project, $dbForProject, $usage, $mode, $deviceFiles) {
+ ->inject('deviceLocal')
+ ->action(function ($bucketId, $fileId, $width, $height, $gravity, $quality, $borderWidth, $borderColor, $borderRadius, $opacity, $rotation, $background, $output, $request, $response, $project, $dbForProject, $usage, $mode, $deviceFiles, $deviceLocal) {
/** @var Utopia\Swoole\Request $request */
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Document $project */
@@ -935,6 +936,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
$background = (empty($background)) ? 'eceff1' : $background;
$type = \strtolower(\pathinfo($path, PATHINFO_EXTENSION));
$key = \md5($path . $width . $height . $gravity . $quality . $borderWidth . $borderColor . $borderRadius . $opacity . $rotation . $background . $output);
+ $deviceFiles = $deviceLocal;
}
diff --git a/app/controllers/mock.php b/app/controllers/mock.php
index a45bdf641e..8d85b94578 100644
--- a/app/controllers/mock.php
+++ b/app/controllers/mock.php
@@ -244,6 +244,9 @@ App::post('/v1/mock/tests/general/upload')
$file = $request->getFiles('file');
$contentRange = $request->getHeader('content-range');
+
+ $chunkSize = 5*1024*1024; // 5MB
+
if(!empty($contentRange)) {
$start = $request->getContentRangeStart();
$end = $request->getContentRangeEnd();
@@ -267,21 +270,25 @@ App::post('/v1/mock/tests/general/upload')
throw new Exception('All chunked request must have id header (except first)', 400, Exception::GENERAL_MOCK);
}
- if($end !== $size && $end-$start+1 !== 5*1024*1024) {
+ if($end !== $size && $end-$start+1 !== $chunkSize) {
throw new Exception('Chunk size must be 5MB (except last chunk)', 400, Exception::GENERAL_MOCK);
}
foreach ($file['size'] as $i => $sz) {
- if ($end !== $size && $sz !== 5*1024*1024) {
+ if ($end !== $size && $sz !== $chunkSize) {
throw new Exception('Wrong chunk size', 400, Exception::GENERAL_MOCK);
}
- if($sz > 5*1024*1024) {
+ if($sz > $chunkSize) {
throw new Exception('Chunk size must be 5MB or less', 400, Exception::GENERAL_MOCK);
}
}
if($end !== $size) {
- $response->json(['$id'=> 'newfileid']);
+ $response->json([
+ '$id'=> 'newfileid',
+ 'chunksTotal' => $file['size'] / $chunkSize,
+ 'chunksUploaded' => $start / $chunkSize
+ ]);
}
} else {
$file['tmp_name'] = (\is_array($file['tmp_name'])) ? $file['tmp_name'] : [$file['tmp_name']];
diff --git a/app/views/console/functions/function.phtml b/app/views/console/functions/function.phtml
index f9553f45e8..8ea9d2f8a0 100644
--- a/app/views/console/functions/function.phtml
+++ b/app/views/console/functions/function.phtml
@@ -645,6 +645,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
@@ -654,6 +655,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
diff --git a/app/workers/deletes.php b/app/workers/deletes.php
index 041652e880..963488a00a 100644
--- a/app/workers/deletes.php
+++ b/app/workers/deletes.php
@@ -129,7 +129,7 @@ class DeletesV1 extends Worker
$dbForProject = $this->getProjectDB($projectId);
- $dbForProject->deleteCollection('collection_' . $collectionId);
+ $dbForProject->deleteCollection('collection_' . $document->getInternalId());
$this->deleteByGroup('attributes', [
new Query('collectionId', Query::TYPE_EQUAL, [$collectionId])
diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php
index 214b9d858f..1e4d323fc1 100644
--- a/src/Appwrite/Specification/Format/OpenAPI3.php
+++ b/src/Appwrite/Specification/Format/OpenAPI3.php
@@ -453,10 +453,14 @@ class OpenAPI3 extends Format
switch ($rule['type']) {
case 'string':
- case 'json':
$type = 'string';
break;
+ case 'json':
+ $type = 'object';
+ $output['components']['schemas'][$model->getType()]['properties'][$name]['additionalProperties'] = true;
+ break;
+
case 'integer':
$type = 'integer';
$format = 'int32';
@@ -516,9 +520,6 @@ class OpenAPI3 extends Format
$output['components']['schemas'][$model->getType()]['properties'][$name]['items']['format'] = $format;
}
- if($items) {
- $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items;
- }
} else {
$output['components']['schemas'][$model->getType()]['properties'][$name] = [
'type' => $type,
@@ -530,9 +531,9 @@ class OpenAPI3 extends Format
$output['components']['schemas'][$model->getType()]['properties'][$name]['format'] = $format;
}
- if($items) {
- $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items;
- }
+ }
+ if($items) {
+ $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items;
}
if (!in_array($name, $required)) {
$output['components']['schemas'][$model->getType()]['properties'][$name]['nullable'] = true;
diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php
index e24030ea7e..f0303e214a 100644
--- a/src/Appwrite/Specification/Format/Swagger2.php
+++ b/src/Appwrite/Specification/Format/Swagger2.php
@@ -444,10 +444,14 @@ class Swagger2 extends Format
switch ($rule['type']) {
case 'string':
- case 'json':
$type = 'string';
break;
+ case 'json':
+ $type = 'object';
+ $output['definitions'][$model->getType()]['properties'][$name]['additionalProperties'] = true;
+ break;
+
case 'integer':
$type = 'integer';
$format = 'int32';
@@ -469,7 +473,7 @@ class Swagger2 extends Format
default:
$type = 'object';
- $rule['type'] = ($rule['type']) ? $rule['type'] : 'none';
+ $rule['type'] = ($rule['type']) ?: 'none';
if(\is_array($rule['type'])) {
if($rule['array']) {
@@ -508,14 +512,10 @@ class Swagger2 extends Format
$output['definitions'][$model->getType()]['properties'][$name]['items']['format'] = $format;
}
- if($items) {
- $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items;
- }
} else {
$output['definitions'][$model->getType()]['properties'][$name] = [
'type' => $type,
'description' => $rule['description'] ?? '',
- //'default' => $rule['default'] ?? null,
'x-example' => $rule['example'] ?? null,
];
@@ -523,9 +523,9 @@ class Swagger2 extends Format
$output['definitions'][$model->getType()]['properties'][$name]['format'] = $format;
}
- if($items) {
- $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items;
- }
+ }
+ if($items) {
+ $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items;
}
if (!in_array($name, $required)) {
$output['definitions'][$model->getType()]['properties'][$name]['x-nullable'] = true;