소스 검색

Check uploaded data for more than one VCALENDAR

Unrud 8 년 전
부모
커밋
d0aacd3dcf
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      radicale/__init__.py

+ 4 - 1
radicale/__init__.py

@@ -824,7 +824,7 @@ class Application:
                 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]
@@ -837,6 +837,9 @@ class Application:
                         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