Clamp future timestamps to now

This commit is contained in:
0x464e 2026-03-20 19:52:06 +02:00
parent 99fa5e1dee
commit 8381c12920
No known key found for this signature in database
GPG Key ID: E6D221DF6CBFBFFA

View File

@ -26,6 +26,7 @@ export function parseRecordingReviewLink(
} }
const parsedTimestamp = Number(timestamp); const parsedTimestamp = Number(timestamp);
const now = Math.floor(Date.now() / 1000);
if (!Number.isFinite(parsedTimestamp) || parsedTimestamp <= 0) { if (!Number.isFinite(parsedTimestamp) || parsedTimestamp <= 0) {
return undefined; return undefined;
@ -33,7 +34,8 @@ export function parseRecordingReviewLink(
return { return {
camera, camera,
timestamp: Math.floor(parsedTimestamp), // clamp future timestamps to now
timestamp: Math.min(Math.floor(parsedTimestamp), now),
}; };
} }