Skip to content

Commit

Permalink
Check uploaded data for more than one VCALENDAR
Browse files Browse the repository at this point in the history
  • Loading branch information
Unrud authored and Unrud committed Jul 22, 2017
1 parent 316b0a5 commit d0aacd3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion radicale/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ def do_PUT(self, environ, base_prefix, path, user):
items = tuple(vobject.readComponents(content or ""))
if not write_whole_collection and len(items) != 1:
raise RuntimeError(
"Content contains %d components" % len(items))
"Item contains %d components" % len(items))
if write_whole_collection or not parent_item.get_meta("tag"):
content_type = environ.get("CONTENT_TYPE",
"").split(";")[0]
Expand All @@ -837,6 +837,9 @@ def do_PUT(self, environ, base_prefix, path, user):
tag = "VADDRESSBOOK"
else:
tag = parent_item.get_meta("tag")
if tag == "VCALENDAR" and len(items) > 1:
raise RuntimeError("VCALENDAR collection contains %d "
"components" % len(items))
for i in items:
storage.check_and_sanitize_item(
i, is_collection=write_whole_collection, uid=item.uid
Expand Down

0 comments on commit d0aacd3

Please sign in to comment.