Skip to content

Commit cc54a13

Browse files
committed
Fix server error when passing null collection types.
1 parent 386c01d commit cc54a13

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

etebase_server/fastapi/routers/collection.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,10 @@ def _create(data: CollectionIn, user: UserType):
342342
# TODO
343343
process_revisions_for_item(main_item, data.item.content)
344344

345-
collection_type_obj, _ = models.CollectionType.objects.get_or_create(uid=data.collectionType, owner=user)
345+
try:
346+
collection_type_obj, _ = models.CollectionType.objects.get_or_create(uid=data.collectionType, owner=user)
347+
except IntegrityError:
348+
raise ValidationError("bad_collection_type", "collectionType is null")
346349

347350
models.CollectionMember(
348351
collection=instance,

0 commit comments

Comments
 (0)