Bug 1384587 - Outlook CSV import is broken. r=mschroeder a=philipp DONTBUILD
authorMakeMyDay <makemyday@gmx-topmail.de>
Sat, 29 Jul 2017 22:04:07 +0200
changeset 28329 13c8920ec9a856084e0a922aedf87698eb8472f6
parent 28328 de3c731057eb7dc4f9f7f4ced6b7dcfda508f5f9
child 28330 72d7059579e0275a3755fed8f85b1baeb671e1a0
push id1983
push usermozilla@jorgk.com
push dateMon, 31 Jul 2017 05:59:12 +0000
treeherdercomm-beta@13c8920ec9a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmschroeder, philipp
bugs1384587
Bug 1384587 - Outlook CSV import is broken. r=mschroeder a=philipp DONTBUILD
calendar/import-export/calOutlookCSVImportExport.js
--- a/calendar/import-export/calOutlookCSVImportExport.js
+++ b/calendar/import-export/calOutlookCSVImportExport.js
@@ -142,41 +142,43 @@ calOutlookCSVImporter.prototype = {
         // strip header from string
         str = str.slice(trimResults[0].length);
 
         let args = {};
         // args.fieldList contains the field names from the first row of CSV
         args.fieldList = header;
 
         let knownIndxs;
-        for (let locale of locales) {
+        let locale = localeEn;
+        for (let loc of locales) {
             knownIndxs = 0;
             args.titleIndex = 0;
             args.startDateIndex = 0;
             for (let i = 1; i <= header.length; ++i) {
                 switch (header[i - 1]) {
                     /* eslint-disable max-statements-per-line */
-                    case locale.headTitle: args.titleIndex = i; knownIndxs++; break;
-                    case locale.headStartDate: args.startDateIndex = i; knownIndxs++; break;
-                    case locale.headStartTime: args.startTimeIndex = i; knownIndxs++; break;
-                    case locale.headEndDate: args.endDateIndex = i; knownIndxs++; break;
-                    case locale.headEndTime: args.endTimeIndex = i; knownIndxs++; break;
-                    case locale.headAllDayEvent: args.allDayIndex = i; knownIndxs++; break;
-                    case locale.headAlarm: args.alarmIndex = i; knownIndxs++; break;
-                    case locale.headAlarmDate: args.alarmDateIndex = i; knownIndxs++; break;
-                    case locale.headAlarmTime: args.alarmTimeIndex = i; knownIndxs++; break;
-                    case locale.headCategories: args.categoriesIndex = i; knownIndxs++; break;
-                    case locale.headDescription: args.descriptionIndex = i; knownIndxs++; break;
-                    case locale.headLocation: args.locationIndex = i; knownIndxs++; break;
-                    case locale.headPrivate: args.privateIndex = i; knownIndxs++; break;
+                    case loc.headTitle: args.titleIndex = i; knownIndxs++; break;
+                    case loc.headStartDate: args.startDateIndex = i; knownIndxs++; break;
+                    case loc.headStartTime: args.startTimeIndex = i; knownIndxs++; break;
+                    case loc.headEndDate: args.endDateIndex = i; knownIndxs++; break;
+                    case loc.headEndTime: args.endTimeIndex = i; knownIndxs++; break;
+                    case loc.headAllDayEvent: args.allDayIndex = i; knownIndxs++; break;
+                    case loc.headAlarm: args.alarmIndex = i; knownIndxs++; break;
+                    case loc.headAlarmDate: args.alarmDateIndex = i; knownIndxs++; break;
+                    case loc.headAlarmTime: args.alarmTimeIndex = i; knownIndxs++; break;
+                    case loc.headCategories: args.categoriesIndex = i; knownIndxs++; break;
+                    case loc.headDescription: args.descriptionIndex = i; knownIndxs++; break;
+                    case loc.headLocation: args.locationIndex = i; knownIndxs++; break;
+                    case loc.headPrivate: args.privateIndex = i; knownIndxs++; break;
                     /* eslint-enable max-statements-per-line */
                 }
             }
             // Were both mandatory fields recognized?
             if (args.titleIndex != 0 && args.startDateIndex != 0) {
+                locale = loc;
                 break;
             }
         }
 
         if (knownIndxs == 0 && header.length == 22) {
             // set default indexes for a default Outlook2000 CSV file
             args.titleIndex = 1;
             args.startDateIndex = 2;
@@ -369,17 +371,17 @@ calOutlookCSVImporter.prototype = {
         let date = cal.createDateTime();
 
         // XXX Can we do better?
         date.timezone = cal.floating();
 
         let datepart = aLocale.dateRe.exec(aDate);
         let timepart = aLocale.timeRe.exec(aTime);
 
-        if (!datepart || !timepart) {
+        if (!datepart) {
             return null;
         }
 
         date.year = datepart[aLocale.dateYearIndex];
         date.month = datepart[aLocale.dateMonthIndex] - 1;
         date.day = datepart[aLocale.dateDayIndex];
         if (timepart) {
             date.hour = Number(timepart[aLocale.timeHourIndex]);