1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-01 18:18:31 +00:00

improved detection of broken vcards

This commit is contained in:
Peter Bieringer 2016-09-18 19:23:24 +02:00
parent 18181374e1
commit af5c1582dc
2 changed files with 24 additions and 4 deletions

View file

@ -715,9 +715,21 @@ class Collection(BaseCollection):
self.logger.debug("Read object: %s", path)
with open(path, encoding=self.encoding, newline="") as fd:
try:
items.append(vobject.readOne(fd.read()))
# check whether vobject liks the item
item = vobject.readOne(fd.read())
except:
self.logger.exception("Object broken (skip 'list'): %s", path)
continue
if self.get_meta("tag") == "VADDRESSBOOK":
try:
# check whether vobject liks the VCARD item
item.serialize()
except:
self.logger.exception("Object broken (skip 'read'): %s", path)
self.logger.error("Broken VCARD content: %s", item)
continue
items.append(item)
time_end = datetime.datetime.now()
self.logger.info("Collection read %d items in %s sec from %s", len(items),(time_end - time_begin).total_seconds(), self._filesystem_path)
if self.get_meta("tag") == "VCALENDAR":