Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken fix #1370

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions radicale/item/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,17 @@ def check_and_sanitize_items(
component_uid = get_uid(component)
if component_uid:
component_uids.add(component_uid)
component_name = None
object_uid = None
object_uid_set = False
component_dict = dict()
for component in vobject_item.components():
# https://tools.ietf.org/html/rfc4791#section-4.1
if component.name == "VTIMEZONE":
continue
if component_name is None or is_collection:
component_name = component.name
elif component_name != component.name:
raise ValueError("Multiple component types in object: %r, %r" %
(component_name, component.name))
if component_name not in ("VTODO", "VEVENT", "VJOURNAL"):
if component.name in component_dict:
raise ValueError("Multiple components of same type in object: %r" % (component.name))
component_dict[component.name] = True
if component.name not in ("VTODO", "VEVENT", "VJOURNAL"):
continue
component_uid = get_uid(component)
if not object_uid_set or is_collection:
Expand All @@ -130,7 +128,7 @@ def check_and_sanitize_items(
if not component_uid:
if not is_collection:
raise ValueError("%s component without UID in object" %
component_name)
component.name)
component_uid = find_available_uid(
component_uids.__contains__)
component_uids.add(component_uid)
Expand All @@ -140,19 +138,15 @@ def check_and_sanitize_items(
component.add("UID").value = component_uid
elif not object_uid or not component_uid:
raise ValueError("Multiple %s components without UID in "
"object" % component_name)
elif object_uid != component_uid:
raise ValueError(
"Multiple %s components with different UIDs in object: "
"%r, %r" % (component_name, object_uid, component_uid))
"object" % component.name)
# Workaround for bug in Lightning (Thunderbird)
# Rescheduling a single occurrence from a repeating event creates
# an event with DTEND and DURATION:PT0S
if (hasattr(component, "dtend") and
hasattr(component, "duration") and
component.duration.value == timedelta(0)):
logger.debug("Quirks: Removing zero duration from %s in "
"object %r", component_name, component_uid)
"object %r", component.name, component_uid)
del component.duration
# Workaround for Evolution
# EXDATE has value DATE even if DTSTART/DTEND is DATE-TIME.
Expand Down
50 changes: 50 additions & 0 deletions radicale/tests/static/event_vjournal_vevent.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//mozilla.org/Mozilla Thunderbird//EN
BEGIN:VTIMEZONE
TZID:US/Pacific
BEGIN:STANDARD
DTSTART:19671029T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19870405T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
SEQUENCE:0
DTSTART;TZID=US/Pacific:20021028T140000
RRULE:FREQ=WEEKLY;COUNT=10
DTSTAMP:20021028T011706Z
SUMMARY:Coffee with Jason
UID:EC9439B1-FF65-11D6-9973-003065F99D04
DTEND;TZID=US/Pacific:20021028T150000
BEGIN:VALARM
TRIGGER;VALUE=DURATION:-P1D
ACTION:DISPLAY
DESCRIPTION:Event reminder\, with comma\nand line feed
END:VALARM
END:VEVENT
BEGIN:VJOURNAL
UID:[email protected]
DTSTAMP:19970901T130000Z
DTSTART;VALUE=DATE:19970317
SUMMARY:Staff meeting minutes
DESCRIPTION:1. Staff meeting: Participants include Joe\,
Lisa\, and Bob. Aurora project plans were reviewed.
There is currently no budget reserves for this project.
Lisa will escalate to management. Next meeting on Tuesday.\n
2. Telephone Conference: ABC Corp. sales representative
called to discuss new printer. Promised to get us a demo by
Friday.\n3. Henry Miller (Handsoff Insurance): Car was
totaled by tree. Is looking into a loaner car. 555-2323
(tel).
END:VJOURNAL
END:VCALENDAR
Loading