diff --git a/radicale/storage.py b/radicale/storage.py
index d670daf..a0cbe6d 100644
--- a/radicale/storage.py
+++ b/radicale/storage.py
@@ -529,7 +529,8 @@ class Collection(BaseCollection):
for item in items:
for content in ("vevent", "vtodo", "vjournal"):
if content in item.contents:
- collection.add(getattr(item, content))
+ for item_part in getattr(item, "%s_list" % content):
+ collection.add(item_part)
break
return collection.serialize()
elif self.get_meta("tag") == "VADDRESSBOOK":
diff --git a/tests/static/event2.ics b/tests/static/event2.ics
index 2844312..8695944 100644
--- a/tests/static/event2.ics
+++ b/tests/static/event2.ics
@@ -28,5 +28,15 @@ SUMMARY:Event2
DTSTART;TZID=Europe/Paris:20130902T180000
DTEND;TZID=Europe/Paris:20130902T190000
RRULE:FREQ=WEEKLY
+SEQUENCE:1
+END:VEVENT
+BEGIN:VEVENT
+DTSTART;TZID=Europe/Paris:20130910T170000
+DTEND;TZID=Europe/Paris:20130910T180000
+DTSTAMP:20140902T150158Z
+SUMMARY:Event2
+UID:event2
+RECURRENCE-ID;TZID=Europe/Paris:20130909T180000
+SEQUENCE:2
END:VEVENT
END:VCALENDAR
diff --git a/tests/test_base.py b/tests/test_base.py
index ed88568..5fd3ba7 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -97,6 +97,20 @@ class BaseRequests:
status, headers, answer = self.request("GET", "/calendar.ics/")
assert "VEVENT" not in answer
+ def test_multiple_events_with_same_uid(self):
+ """Add two events with the same UID."""
+ self.request("MKCOL", "/calendar.ics/")
+ self.request("PUT", "/calendar.ics/", get_file_content("event2.ics"))
+ status, headers, answer = self.request(
+ "REPORT", "/calendar.ics/",
+ """
+
+
+ """)
+ assert answer.count("") == 1
+ status, headers, answer = self.request("GET", "/calendar.ics/")
+ assert answer.count("BEGIN:VEVENT") == 2
+
def _test_filter(self, filters, kind="event", items=1):
filters_text = "".join(
"%s" % filter_ for filter_ in filters)