From 5081fcbcd1f558f92341a04917a7984650f5d117 Mon Sep 17 00:00:00 2001 From: Unrud Date: Fri, 15 Jan 2016 01:09:43 +0100 Subject: [PATCH 1/2] Use component names to filter duplicates --- radicale/storage/multifilesystem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radicale/storage/multifilesystem.py b/radicale/storage/multifilesystem.py index d4243d92..3bd9b277 100644 --- a/radicale/storage/multifilesystem.py +++ b/radicale/storage/multifilesystem.py @@ -80,7 +80,7 @@ class Collection(filesystem.Collection): def text(self): components = ( ical.Timezone, ical.Event, ical.Todo, ical.Journal, ical.Card) - items = set() + items = {} try: filenames = os.listdir(self._filesystem_path) except (OSError, IOError) as e: @@ -99,7 +99,7 @@ class Collection(filesystem.Collection): 'Error while reading item %r: %r' % (path, e)) return ical.serialize( - self.tag, self.headers, sorted(items, key=lambda x: x.name)) + self.tag, self.headers, sorted(items.values(), key=lambda x: x.name)) @classmethod def is_node(cls, path): From a55cff8eb6a17f06e965d5c9ac765bdf080bf66d Mon Sep 17 00:00:00 2001 From: Unrud Date: Fri, 15 Jan 2016 01:13:18 +0100 Subject: [PATCH 2/2] Also remove items from the collections itself --- radicale/storage/multifilesystem.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/radicale/storage/multifilesystem.py b/radicale/storage/multifilesystem.py index 3bd9b277..16b6c63b 100644 --- a/radicale/storage/multifilesystem.py +++ b/radicale/storage/multifilesystem.py @@ -72,6 +72,8 @@ class Collection(filesystem.Collection): "Can't tranlate name safely to filesystem, " "skipping component: %s", name) return + if name in self.items: + del self.items[name] filesystem_path = os.path.join(self._filesystem_path, name) if os.path.exists(filesystem_path): os.remove(filesystem_path)