1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

Merge pull request #1773 from pbiering/collection-upload-prepare-catch

catch error on item.prepare in case of collection upload
This commit is contained in:
Peter Bieringer 2025-04-29 21:01:47 +02:00 committed by GitHub
commit bfd0ca7cdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,7 @@
import errno
import itertools
import logging
import posixpath
import re
import socket
@ -89,7 +90,15 @@ def prepare(vobject_items: List[vobject.base.Component], path: str,
vobject_collection.add(vobject.base.ContentLine("PRODID", [], PRODID))
item = radicale_item.Item(collection_path=collection_path,
vobject_item=vobject_collection)
item.prepare()
logger.debug("Prepare item with UID '%s'", item.uid)
try:
item.prepare()
except ValueError as e:
if logger.isEnabledFor(logging.DEBUG):
logger.warning("Problem during prepare item with UID '%s' (content below): %s\n%s", item.uid, e, item._text)
else:
logger.warning("Problem during prepare item with UID '%s' (content suppressed in this loglevel): %s", item.uid, e)
raise
items.append(item)
elif write_whole_collection and tag == "VADDRESSBOOK":
for vobject_item in vobject_items: