fix: prevent potential crashes

This commit is contained in:
Stefano Borzì 2026-01-23 14:50:35 +01:00 committed by GitHub
parent a6001ee47a
commit 91db3f91b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,7 +71,8 @@ export class DataTablesSsp {
this.length = Math.min(100, Math.max(0, parseInt(query.length as string, 10))); this.length = Math.min(100, Math.max(0, parseInt(query.length as string, 10)));
this.draw = parseInt(query.draw as string, 10); this.draw = parseInt(query.draw as string, 10);
this._order = (query.order as { column: string; dir: string }[]).map((order) => { this._order = (query.order as { column: string; dir: string }[]).map((order) => {
return { column: parseInt(order.column, 10), dir: order.dir }; const dir = order.dir.toUpperCase() === "DESC" ? "DESC" : "ASC";
return { column: parseInt(order.column, 10), dir };
}); });
this.columns = ( this.columns = (
query.columns as { data: string; name: string; searchable: string; orderable: string; search: { value: string; regex: string } }[] query.columns as { data: string; name: string; searchable: string; orderable: string; search: { value: string; regex: string } }[]