feat(import): harden workbook parser boundaries
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { SkillEntry } from "@capakraken/shared";
|
||||
import { assertHeaderRow, assertTabularMatrixWithinLimits } from "./excel.js";
|
||||
|
||||
type ExcelJsModule = typeof import("exceljs");
|
||||
|
||||
@@ -80,7 +81,9 @@ function worksheetToRowObjects(
|
||||
rows.push(cells);
|
||||
}
|
||||
|
||||
assertTabularMatrixWithinLimits(rows, "skill matrix import");
|
||||
const headers = (rows[0] ?? []).map((header) => header.trim());
|
||||
assertHeaderRow(headers, "skill matrix import");
|
||||
if (headers.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user