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

Ignore X-... properties also at end of file? #350

Closed
mmoole opened this issue Feb 20, 2022 · 6 comments · Fixed by #616
Closed

Ignore X-... properties also at end of file? #350

mmoole opened this issue Feb 20, 2022 · 6 comments · Fixed by #616

Comments

@mmoole
Copy link

mmoole commented Feb 20, 2022

Dear icalendar team,

there is a simple caching mechanism built into the site and thus cached copies of the .ics have a string attached pointing to this at the very end of the file. It looks like this:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Podio API//EN//view-exporter//52593453
METHOD:REQUEST
X-WR-CALNAME:view52593586
X-WR-TIMEZONE:Europe/Berlin
CALSCALE:GREGORIAN
X-COMMENT-USAGE:This calendar does not contain recurring events!
X-COMMENT-GENERATOR:PHP Version 8.0.16 
BEGIN:VEVENT
STATUS:CONFIRMED
SEQUENCE:0
TRANSP:OPAQUE
CLASS:PUBLIC
UID:20055546456446
SUMMARY:Termin 4353 und"so"
DESCRIPTION;ALTREP="data:text/html,%3Cbody%3E%3Cp%3EToller%20%3Cstron
	g%20class%3D%22text-bold%22%3ETermin%3C%2Fstrong%3E%20f%C3%BCr%3C%2Fp
	%3E%3Cblockquote%3E%3Cp%3Emal%20%3Cem%20class%3D%22text-italic%22%3Ez
	u%22gucken%22%3C%2Fem%3E%3C%2Fp%3E%3C%2Fblockquote%3E%3Cp%3E%3Cu%20cl
	ass%3D%22text-underline%22%3Eund%3C%2Fu%3E%20%3Cdel%3Eso%3C%2Fdel%3E%
	3Cbr%2F%3E%3C%2Fp%3E%3C%2Fbody%3E":Toller Termin fürmal zu\"gucken\"
	und so
X-ALT-DESC;FMTTYPE=text/html:<html><head></head><body><p>Toller <stro
	ng class="text-bold">Termin</strong> für</p><blockquote><p>mal <em c
	lass="text-italic">zu"gucken"</em></p></blockquote><p><u class="text-
	underline">und</u> <del>so</del><br/></p></body></html>
URL:https://podio.com/xxxxxxyyyyyy/zpodio-testgelande/apps/calen
	dar/items/5
LOCATION:online
DTSTART:20220222T183000Z
DTEND:20220222T193000Z
DTSTAMP:20220220T142821Z
END:VEVENT
END:VCALENDAR
X-COMMENT:Cached from 2022-02-20 14:28:21 - new at most every 1800sec.

Now icalendar is showing this error: Property "X-COMMENT" does not have a parent component.
But the file validates fine at https://icalendar.org/validator.html and on the other hand properties beginning with X- may be ignored nevertheless.

So this is to suggest ignoring properties beginning with X- at least for the check if they are within a parent component. Would that be possible?

@angatha
Copy link
Collaborator

angatha commented Sep 26, 2022

I didn't read RFC5545 complete but I'm sure that the content of an .ics file can only be an icalstream. This allows for one or more VCANELDAR components but nothing else. So the file is actually invalid and therefore, the error is expected. The part about ignoring unknown X- and IANA-registered properties, (components and parameters) doesn't apply in this case, for that reason.

@mmoole can you please provide the code snipped that you used to parse this?
Maybe it is possible instead of raising an exception to store the exception in the errors list? Depending on the used method (e.g. Calendar.from_ical()) determine the "correct" object may be difficult when multiple=True.

@yeshwantthota
Copy link

Hey, I am a beginner in open source and want to contribute to this project. So can anybody guide me on how to make my first contribution.

@niccokunzmann
Copy link
Member

Hello @yeshwantthota, welcome! I can see that you have a few projects yourself, so you seem familiar with Git and GitHub. You can find a link to the documentation on this page: https://github.com/collective/icalendar. I should describe how to set up icalendar on your system. If not - this is something worth documenting.

After you have a local copy and the tox tests run, you can start contributing to this issue or other issues of the project.
For this one, you can copy the file mentioned above into the calendars folder of the tests and write a test that reads the file - look at the other tests - this requires less than 4 lines of code. If you have any questions, you can ask me or @jacadzaca who added the label to this issue and might have ideas about how to help with this one.

Could I help you any further?

@mmoole
Copy link
Author

mmoole commented Oct 18, 2022

Hello, I am using open-web-calendar which uses icalendar, so I cannot say exactly where the code snippet would reside 🤷🏼‍♂️

@niccokunzmann
Copy link
Member

niccokunzmann commented Oct 19, 2022 via email

This was referenced May 20, 2024
@mmoole
Copy link
Author

mmoole commented May 20, 2024

Wonderful 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants