fix: sanitise cue import (#519)

* fix: sanitise cue import
This commit is contained in:
Carlos Valente
2023-09-11 21:06:32 +02:00
committed by GitHub
parent 93fb48ea1c
commit 0bb09dd039
2 changed files with 29 additions and 7 deletions
+6 -7
View File
@@ -100,19 +100,19 @@ export const parseExcel = async (excelData) => {
} else if (j === timeEndIndex) {
event.timeEnd = parseExcelDate(column);
} else if (j === titleIndex) {
event.title = column;
event.title = makeString(column, '');
} else if (j === cueIndex) {
event.cue = column;
event.cue = makeString(column, '');
} else if (j === presenterIndex) {
event.presenter = column;
event.presenter = makeString(column, '');
} else if (j === subtitleIndex) {
event.subtitle = column;
event.subtitle = makeString(column, '');
} else if (j === isPublicIndex) {
event.isPublic = Boolean(column);
} else if (j === skipIndex) {
event.skip = Boolean(column);
} else if (j === notesIndex) {
event.note = column;
event.note = makeString(column, '');
} else if (j === endActionIndex) {
if (column === '') {
event.endAction = EndAction.None;
@@ -326,7 +326,6 @@ export const parseJson = async (jsonData, enforce = false): Promise<DatabaseMode
export const validateEvent = (eventArgs: Partial<OntimeEvent>, cueFallback: string) => {
// ensure id is defined and unique
const id = eventArgs.id || generateId();
const cue = eventArgs.cue || cueFallback;
let event = null;
@@ -365,7 +364,7 @@ export const validateEvent = (eventArgs: Partial<OntimeEvent>, cueFallback: stri
user9: makeString(e.user9, d.user9),
colour: makeString(e.colour, d.colour),
id,
cue,
cue: makeString(e.cue, cueFallback),
type: 'event',
};
}