Hi! I'm trying to upgrade from v6 to v7, and I noticed a change in behavior related to ATTACH parsing - I'm now seeing a vBinary component in a situation where I previously saw a vUri.
To reproduce
import icalendar
data = b"""
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:19960704T120000Z
UID:uid1@example.com
ORGANIZER:mailto:jsmith@example.com
DTSTART:19960918T143000Z
DTEND:19960920T220000Z
STATUS:CONFIRMED
CATEGORIES:CONFERENCE
SUMMARY:Summary
DESCRIPTION:Description
ATTACH;VALUE=BINARY;ENCODING=BASE64;X-FILENAME=image.png:
bm90IGEgcmVhbCBwbmcgYnV0IHNob3VsZG4ndCBtYXR0ZXIuLg==
END:VEVENT
END:VCALENDAR
"""
ical = icalendar.Calendar.from_ical(data)
print(ical)
attach = ical.subcomponents[0]["ATTACH"]
print(type(attach))
Output:
With icalendar==6.3.2 this produced
VCALENDAR({'VERSION': vText(b'2.0')}, VEVENT({'DTSTAMP': vDDDTypes(1996-07-04 12:00:00+00:00, Parameters({})), 'UID': vText(b'uid1@example.com'), 'ORGANIZER': vCalAddress('mailto:jsmith@example.com'), 'DTSTART': vDDDTypes(1996-09-18 14:30:00+00:00, Parameters({})), 'DTEND': vDDDTypes(1996-09-20 22:00:00+00:00, Parameters({})), 'STATUS': vText(b'CONFIRMED'), 'CATEGORIES': <icalendar.prop.vCategory object at 0x73ffd5abe4b0>, 'SUMMARY': vText(b'Summary'), 'DESCRIPTION': vText(b'Description'), 'ATTACH': 'bm90IGEgcmVhbCBwbmcgYnV0IHNob3VsZG4ndCBtYXR0ZXIuLg=='}))
<class 'icalendar.prop.vUri'>
but with icalendar==7.0.3 it produces
VCALENDAR({'VERSION': vText(b'2.0')}, VEVENT({'DTSTAMP': vDDDTypes(1996-07-04 12:00:00+00:00, Parameters({})), 'UID': vText(b'uid1@example.com'), 'ORGANIZER': vCalAddress('mailto:jsmith@example.com'), 'DTSTART': vDDDTypes(1996-09-18 14:30:00+00:00, Parameters({})), 'DTEND': vDDDTypes(1996-09-20 22:00:00+00:00, Parameters({})), 'STATUS': vText(b'CONFIRMED'), 'CATEGORIES': vCategory([vText(b'CONFERENCE')], params=Parameters({})), 'SUMMARY': vText(b'Summary'), 'DESCRIPTION': vText(b'Description'), 'ATTACH': vBinary(b'bm90IGEgcmVhbCBwbmcgYnV0IHNob3VsZG4ndCBtYXR0ZXIuLg==')}))
<class 'icalendar.prop.binary.vBinary'>
Environment
Additional context
Hi! I'm trying to upgrade from v6 to v7, and I noticed a change in behavior related to ATTACH parsing - I'm now seeing a
vBinarycomponent in a situation where I previously saw avUri.To reproduce
Output:
With
icalendar==6.3.2this producedbut with
icalendar==7.0.3it producesEnvironment
icalendarversion: 6.3.2 and 7.0.3Additional context
pip3 install --upgrade https://github.com/collective/icalendar.git..icssample file example.ics.txt