calcurse-caldav: Avoid corrupting the sync DB
When importing an iCal event via calcurse fails (i.e. does not return a single object hash), do not write anything to the synchronization database instead of blindly appending the entry, thereby potentially corrupting the database. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
16e7aecd29
commit
edc44d613b
@ -431,8 +431,15 @@ def pull_objects(hrefs_missing, hrefs_modified, conn, syncdb, etagdict):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
objhash = calcurse_import(cdata)
|
objhash = calcurse_import(cdata)
|
||||||
|
|
||||||
|
# TODO: Add support for importing multiple events at once, see GitHub
|
||||||
|
# issue #20 for details.
|
||||||
|
if re.match(r'[0-ga-f]+$', objhash):
|
||||||
syncdb_add(syncdb, href, etag, objhash)
|
syncdb_add(syncdb, href, etag, objhash)
|
||||||
added += 1
|
added += 1
|
||||||
|
else:
|
||||||
|
print("Failed to import object: {} ({})".format(etag, href),
|
||||||
|
file=sys.stderr)
|
||||||
|
|
||||||
return added
|
return added
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user