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

failing to parse a VEVENT with embedded HTML #84

Closed
rbpasker opened this issue Feb 1, 2013 · 8 comments
Closed

failing to parse a VEVENT with embedded HTML #84

rbpasker opened this issue Feb 1, 2013 · 8 comments

Comments

@rbpasker
Copy link

rbpasker commented Feb 1, 2013

here's a small program copied from the docs:

from icalendar import Calendar, Event
from datetime import datetime
import pprint

calfile = '/Users/rbp/Downloads/calendar.ical'
cal = Calendar.from_ical(open(calfile,'rb').read())
for component in cal.walk():
    pprint.pprint(component)

it breaks on a VEVENT that has embedded HTML. this violates RFC 2445 4.1, for sure. but it seems that Calendar on both OS/X 10.8 and IOS 6 both accept it.

 Traceback (most recent call last):
  File "tengah/workers/ical/icalworker.py", line 7, in <module>
    cal = Calendar.from_ical(open(calfile,'rb').read())
  File "/Users/rbp/Projects/tengahdb/lib/python2.7/site-packages/icalendar/cal.py", line 412, in from_ical
   name, params, vals = line.parts()
  File "/Users/rbp/Projects/tengahdb/lib/python2.7/site-packages/icalendar/parser.py", line 526, in parts
    raise ValueError, "Content line could not be parsed into parts: %r: %s" % (self, e)
ValueError: Content line could not be parsed into parts: '<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">Silicon Valley Venture CONNECT:NYC</FONT></SPAN></P>': <P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">Silicon Valley Venture CONNECT

here is the event which has the embedded HTML. Looks like there are no spaces in col 1 before the markup

BEGIN:VEVENT
SUMMARY:Silicon Valley Venture CONNECT: NYC
PRIORITY:5
CLASS:PUBLIC
<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT 
 FACE="Calibri">Silicon Valley Venture CONNECT:NYC</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT 
 FACE="Calibri"></FONT></SPAN><SPAN LANG="en-us"></SPAN><SPAN 
 LANG="en-us"></SPAN><SPAN LANG="en-us">&nbsp:</SPAN></P>
UID:
 040000008200E00074C5B7101A82E0080000000080014D63E6EFCD01000000000000000010
 000000A9040CD0D461274B96FFE0377A232232
DTSTART;TZID=US/Pacific:20130130T150000
SEQUENCE:0
LOCATION:Four Seasons New York (57 East 57th Street)
DTSTAMP:20130116T192905Z
LAST-MODIFIED:20130116T192905Z
CREATED:20130116T192905Z
DTEND;TZID=US/Pacific:20130130T180000
DESCRIPTION:Silicon Valley Venture CONNECT: NYC\n\nWednesday\, January 
 30th\n6 - 9 pm ET\n\nFour Seasons New York\n57 East 57th Street\nNew 
 York\, NY 10022\n \n\n
ATTACH;MANAGED-ID=11e1b05faa;FILENAME=Attachment;
 FMTTYPE=application/octet-stream;SIZE=500209:https:
 //p02-caldav.icloud.com/39941937/attach/2_AFL2YNSD5UD434M3PYAMB3VF6DRYQQQZ
 HDU5UK2FLV7Z72QGJOOF45PMXFGO67IAKJIWMKEYJTD7GECXJQ4RQHGUPW2I6ZNFJ4JWF47UI6
 GCQPQUCIN6QUOCX3ZICVVNWPPZX37ARN2LTCIVUSNNP5VBMYZTBYCKZNAMO42HKCF2JLV5ZAU2
 QMUCGLCJXWZ6XOGVEDMFUUFTI7TWTOTMJ5TKWEXPR7TOTKVWLGI/Attachment
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
 3.2//EN">
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <HTML>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <HEAD>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <META 
 NAME=\"Generator\" CONTENT=\"MS Exchange Server version 
 14.02.5004.000\">
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <TITLE></TITLE>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: </HEAD>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <BODY>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <!-- Converted 
 from text/rtf format -->
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <P DIR=LTR><SPAN 
 LANG=\"en-us\"><FONT FACE=\"Calibri\">Wednesday\, January 
 30th</FONT></SPAN></P>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <P DIR=LTR><SPAN 
 LANG=\"en-us\"><FONT FACE=\"Calibri\">6 - 9 pm ET</FONT></SPAN></P>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <P DIR=LTR><SPAN 
 LANG=\"en-us\"><FONT FACE=\"Calibri\">Four Seasons New 
 York</FONT></SPAN></P>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <P DIR=LTR><SPAN 
 LANG=\"en-us\"><FONT FACE=\"Calibri\">57 East 57th 
 Street</FONT></SPAN></P>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <P DIR=LTR><SPAN 
 LANG=\"en-us\"><FONT FACE=\"Calibri\">New York\, NY 
 10022</FONT></SPAN></P>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: <P DIR=LTR><SPAN 
 LANG=\"en-us\"></SPAN><SPAN LANG=\"en-us\"></SPAN></P>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: </BODY>
X-LIC-ERROR;X-LIC-ERRORTYPE=COMPONENT-PARSE-ERROR:Got a data line\, but 
 could not find a property name or component begin tag: </HTML>
X-MS-OLK-AUTOFILLLOCATION:FALSE
X-MS-OLK-CONFTYPE:0
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
TRANSP:OPAQUE
X-MICROSOFT-DISALLOW-COUNTER:FALSE
@thet
Copy link
Member

thet commented Mar 20, 2013

@rbpasker to me, the ical file seems broken.
the embedded html appears without a property, just somewhere inline.
can you tell me, what application generated this ical string?

@rbpasker
Copy link
Author

It was sent in an email attachment

Here's another instance https://bugzilla.mozilla.org/show_bug.cgi?id=577220

@phubbard
Copy link

I solved this on my system - the issue was for me that, using own cloud as a source, I needed to append "?export" to the ical URL. FYI.

@rbpasker
Copy link
Author

i curl'd the URL with and without ?export and got exactly the same thing

@untitaker
Copy link
Contributor

I think this can be closed.

@geier
Copy link
Collaborator

geier commented Feb 12, 2016

agree

@rbpasker
Copy link
Author

why?

@untitaker
Copy link
Contributor

Because the ics file is completely invalid.

@jacadzaca jacadzaca closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants