Skip to content

Commit

Permalink
Fix server error when passing null collection types.
Browse files Browse the repository at this point in the history
  • Loading branch information
tasn committed Jun 29, 2024
1 parent 386c01d commit cc54a13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion etebase_server/fastapi/routers/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ def _create(data: CollectionIn, user: UserType):
# TODO
process_revisions_for_item(main_item, data.item.content)

collection_type_obj, _ = models.CollectionType.objects.get_or_create(uid=data.collectionType, owner=user)
try:
collection_type_obj, _ = models.CollectionType.objects.get_or_create(uid=data.collectionType, owner=user)
except IntegrityError:
raise ValidationError("bad_collection_type", "collectionType is null")

models.CollectionMember(
collection=instance,
Expand Down

0 comments on commit cc54a13

Please sign in to comment.