open-web-calendar
open-web-calendar copied to clipboard
Error handling: do not include errors/tracebacks as part of the event calendar
At the moment, when there is an error with a particular feed, errors are included in the resulting calendar.
For example, https://open-web-calendar.herokuapp.com/calendar.events.json?specification_url=https://raw.githubusercontent.com/Chaostreff-Potsdam/machbar-kalender/master/calendar-specification.json currently includes the following error:
"Traceback (most recent call last):\n File \"/app/.heroku/python/lib/python3.7/site-packages/icalendar/parser.py\", line 340, in parts\n validate_token(name)\n File \"/app/.heroku/python/lib/python3.7/site-packages/icalendar/parser.py\", line 128, in validate_token\n raise ValueError(name)\nValueError: <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/app/conversion_base.py\", line 49, in retrieve_calendar\n calendars = Calendar.from_ical(calendar_text, multiple=True)\n File \"/app/.heroku/python/lib/python3.7/site-packages/icalendar/cal.py\", line 330, in from_ical\n name, params, vals = line.parts()\n File \"/app/.heroku/python/lib/python3.7/site-packages/icalendar/parser.py\", line 354, in parts\n % (self, exc)\nValueError: Content line could not be parsed into parts: '<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">': <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
I think, such tracebacks should not be included in the calendar (not only, but also because it contains paths on the server, which is generally not advisable from a security standpoint). Maybe we should introduce a separate validation endpoint?
We're using [Polar.sh](https://polar.sh/niccokunzmann) so you can upvote and help fund this issue. We receive the funding once the issue is completed & confirmed by you. Thank you in advance for helping prioritize & fund our work.