This commit is contained in:
@@ -59,8 +59,10 @@ export function parseGameEvent(value: unknown): GameEvent {
|
||||
throw new Error(`players[${index}] must be an object`);
|
||||
const player = value as Record<string, unknown>;
|
||||
for (const key of ['name', 'guid'] as const) {
|
||||
if (typeof player[key] !== 'string' || !player[key].trim())
|
||||
throw new Error(`players[${index}].${key} must be a nonempty string`);
|
||||
if (typeof player[key] !== 'string' || player[key].length > 255 || !player[key].trim())
|
||||
throw new Error(
|
||||
`players[${index}].${key} must be a nonempty string (up to 255 characters)`
|
||||
);
|
||||
}
|
||||
const identity: TelemetryPlayer = {
|
||||
name: player.name as string,
|
||||
|
||||
Reference in New Issue
Block a user