Fix URL null error when no url is given in event
All checks were successful
Jenkins Production Deployment
All checks were successful
Jenkins Production Deployment
This commit is contained in:
parent
a34a5df5a3
commit
fc071096d8
|
@ -39,7 +39,9 @@ const serializeIcalEvent = (icalevent: iCalEvent): string => {
|
||||||
returnString += 'SUMMARY:' + icalevent.summary;
|
returnString += 'SUMMARY:' + icalevent.summary;
|
||||||
returnString += 'DESCRIPTION:' + icalevent.description;
|
returnString += 'DESCRIPTION:' + icalevent.description;
|
||||||
returnString += 'LOCATION:' + icalevent.location;
|
returnString += 'LOCATION:' + icalevent.location;
|
||||||
|
if(!isNullOrBlank(icalevent.url)) {
|
||||||
returnString += 'URL:' + icalevent.url;
|
returnString += 'URL:' + icalevent.url;
|
||||||
|
}
|
||||||
returnString += icalevent.footer;
|
returnString += icalevent.footer;
|
||||||
|
|
||||||
return returnString;
|
return returnString;
|
||||||
|
@ -82,6 +84,8 @@ const addEventToFile = (ical: iCalFile, event: Event) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const createIcalEvent = (event: Event): iCalEvent => {
|
const createIcalEvent = (event: Event): iCalEvent => {
|
||||||
|
let url = event.url ? event.url + '\n' : '';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
header: 'BEGIN:VEVENT\n',
|
header: 'BEGIN:VEVENT\n',
|
||||||
uid: event.uuid + '\n',
|
uid: event.uuid + '\n',
|
||||||
|
@ -92,7 +96,7 @@ const createIcalEvent = (event: Event): iCalEvent => {
|
||||||
summary: event.name + '\n',
|
summary: event.name + '\n',
|
||||||
description: event.description + '\n',
|
description: event.description + '\n',
|
||||||
location: event.location + '\n',
|
location: event.location + '\n',
|
||||||
url: event.url + '\n',
|
url: url,
|
||||||
footer: 'END:VEVENT\n'
|
footer: 'END:VEVENT\n'
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -130,3 +134,11 @@ export interface iCalEvent {
|
||||||
url: string;
|
url: string;
|
||||||
footer: string;
|
footer: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a given string is null, undefined or blank
|
||||||
|
* @param str The string to check
|
||||||
|
*/
|
||||||
|
function isNullOrBlank(str: string | null): boolean {
|
||||||
|
return str === null || str === undefined || str.trim() === '';
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user