Fixing bug that prevented the middleware from working with Thunderbird on Microschrott Windoof
Jenkins Production Deployment Details

- FUCK FILE ENCODINGS
- FUCK BILL GATES
This commit is contained in:
Patrick Müller 2021-10-13 13:10:35 +02:00
parent 7622416a2f
commit 2c2e8610c3
1 changed files with 6 additions and 6 deletions

View File

@ -48,7 +48,7 @@ export const parseIcal = function (icalContents: string): iCalFile {
header = headerMatch[0];
}
header = header.substr(0, header.lastIndexOf('\n'));
header = header.substr(0, header.lastIndexOf('\n') + 1);
let events: iCalEvent[] = [];
let match: any;
@ -67,7 +67,7 @@ export const parseIcal = function (icalContents: string): iCalFile {
};
};
export const getDuration = function(event: string): number {
export const getDuration = function (event: string): number {
let startRegex: RegExp = /DTSTART.*?(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?\r/gm; // Fix this, doesnt match \n but matching Z doesnt work all the time
let endRegex: RegExp = /DTEND.*?(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?\r/gm; // s.o.
@ -80,7 +80,7 @@ export const getDuration = function(event: string): number {
let startDtDay = 0;
let startDtHour = 0;
let startDtMinute = 0;
if(startMatch) {
if (startMatch) {
startDtYear = parseInt(startMatch[1]);
startDtMonth = parseInt(startMatch[2]);
startDtDay = parseInt(startMatch[3]);
@ -94,7 +94,7 @@ export const getDuration = function(event: string): number {
let endDtDay = 0;
let endDtHour = 0;
let endDtMinute = 0;
if(endMatch) {
if (endMatch) {
endDtYear = parseInt(endMatch[1]);
endDtMonth = parseInt(endMatch[2]);
endDtDay = parseInt(endMatch[3]);
@ -106,14 +106,14 @@ export const getDuration = function(event: string): number {
let endDt = new Date(endDtYear, endDtMonth - 1, endDtDay, endDtHour, endDtMinute);
return endDt.getHours() - startDt.getHours();
}
};
export const serializeIcal = function (ical: iCalFile): string {
let resString = ical.head;
ical.body.forEach((event) => {
resString += event.content + '\n';
});
resString += 'END:VCALENDAR';
resString += 'END:VCALENDAR\n';
return resString;
};