0
0
mirror of https://github.com/etesync/server.git synced 2024-09-19 20:32:16 +02:00

Fix server error when passing null collection types.

This commit is contained in:
Tom Hacohen 2024-06-29 14:55:48 -04:00
parent 386c01d89e
commit cc54a136f1

View File

@ -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,