Open Bug 1559357 Opened 5 months ago Updated 5 months ago

Can't import events when filename contains %


(Calendar :: Import and Export, defect)

Not set


(Not tracked)



(Reporter: psychonaut, Unassigned)


Importing events from an iCalendar file fails when the filename contains a string of the form %dd, where dd are two hexadecimal digits. Judging from the error message that appears, Lightning wrongly attempts to URL-decode the filename, replacing such strings with ASCII characters. For example, if you tell Lightning to open a file named %41.ics, it instead attempts to open a file named A.ics.

Steps to reproduce:

  1. Create a valid iCalender file named /tmp/%41.ics
  2. In Thunderbird, go to Events and Tasks->Import and open the aforementioned file.

Observed behaviour:

  1. The event does not get imported. Instead, following error dialog appears:

Unable to read from file:/tmp/A.ics
[Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIFileInputStream.init]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: chrome://calendar/content/import-export.js :: loadEventsFromFile/< :: line 86" data: no]

Expected behaviour:

  1. The event should have been imported.

It should be noted that such filenames are not unheard of in the wild. For example, the popular online service Meetup distributes iCalendar files whose filenames are URL-encoded—today I received a one whose name was Meetup+%232%3A+Sentiment+Analysis.ics, and of course Lightning refused to open it.

Note: Thunderbird is reporting my Lightning version as 6.2.7, but this version is not listed in the Version field of this Bugzilla instance.

What OS do you use? Problem might be specific to this platform.

It works for me using Thunderbird 68 Beta / Lightning 7.0 Beta (Build ID 20190614144722) on Windows 10. I created two files with the given example names and a) opened them as calendar and b) imported into existing calendar. Looks like the % got encoded based on console output:
Lightning: [calICSCalendar] Refreshing %41
Lightning: [calICSCalendar] Parsing ICS succeeded for file:///D:/%2541.ics
Lightning: [calICSCalendar] Refreshing Meetup+%232%3A+Sentiment+Analysis
Lightning: [calICSCalendar] Parsing ICS succeeded for file:///D:/Meetup+%25232%253A+Sentiment+Analysis.ics

I'm using openSUSE Tumbleweed for x86-64.

OS: Unspecified → Linux
Hardware: Unspecified → x86_64
You need to log in before you can comment on or make changes to this bug.