NextCloud / OwnCloud freezes or hangs on importing a large ICS file

This week marks a bittersweet end to my use of BlackBerry smartphones: I retired my BB Priv. BlackBerry no longer makes a device that I can advocate for or recommend. Part of my migration to a new device involves exporting an old device-local calendar that I have been carrying around since BB OS 7. The export went well (plenty of utilities on the app store will let you export a calendar) and I was left with a 16,000 line ICS file that I wanted to migrate.

The problem I ran into is that NextCloud hangs when it tries to process such a large calendar file and does not give any indication about the trouble it has (The web UI would hang with the words Import Scheduled).


References


My Hacky Work-around

My exported.ics file looked approximately like this (just with a TON more entries):

BEGIN:VCALENDAR
PRODID:iCal Import/Export CalDAV 3.1
VERSION:2.0
.
.
.
BEGIN:VEVENT
DTSTART;TZID=America/Denver:20140313T090000
TRANSP:OPAQUE
DTEND;TZID=America/Denver:20140313T100000
ORGANIZER:Migrated Calendar
SUMMARY:Dont forget the things
STATUS:TENTATIVE
DTSTAMP:20161226T140832Z
UID:caaae7dc777fffaa0c333333aab77a933333333a-icalimportexport
END:VEVENT
.
.
.
END:VCALENDAR

I had to split this file into chunks no greater than 6000 lines (less than 160KB in my case) and import each file individually in order to get the NextCloud (I've since migrated off of OwnCloud) calendar importer to work. It was frustrating since the Web UI did not give any hint that the system was choking on the size of the file. The "Import Scheduled" message was completely useless to me in diagnosing this issue.


Important Tip

When you split an ICS file into chunks, Remember to keep the BEGIN:VCALENDAR preamble (everything before the First BEGIN:VEVENT line) and END:VCALENDAR tailer). This wrapper should be present in all sub-files you create and is required to have a properly formatted ICS file that either NextCloud or OwnCloud will know how to process.