Skip to content

Commit 974425d

Browse files
authored
Merge pull request #2350 from nextcloud/fix/invalid-column-type
Check for column type
2 parents 2612a28 + 2104908 commit 974425d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Service/ColumnService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99

1010
use DateTime;
1111
use Exception;
12+
use OCA\Tables\Constants\ColumnType;
1213
use OCA\Tables\Db\Column;
1314
use OCA\Tables\Db\ColumnMapper;
1415
use OCA\Tables\Db\Table;
1516
use OCA\Tables\Db\TableMapper;
1617
use OCA\Tables\Db\View;
1718
use OCA\Tables\Dto\Column as ColumnDto;
19+
use OCA\Tables\Errors\BadRequestError;
1820
use OCA\Tables\Errors\InternalError;
1921
use OCA\Tables\Errors\NotFoundError;
2022
use OCA\Tables\Errors\PermissionError;
@@ -194,6 +196,9 @@ public function create(
194196
ColumnDto $columnDto,
195197
array $selectedViewIds = [],
196198
):Column {
199+
if (ColumnType::tryFrom($columnDto->getType()) === null) {
200+
throw new BadRequestError('Column type ' . $columnDto->getType() . ' does not exist.');
201+
}
197202
// security
198203
if ($viewId) {
199204
try {

0 commit comments

Comments
 (0)