diff --git a/app/routes/circulars/circulars.server.ts b/app/routes/circulars/circulars.server.ts index 89e3ffa80..9dc3292ea 100644 --- a/app/routes/circulars/circulars.server.ts +++ b/app/routes/circulars/circulars.server.ts @@ -240,6 +240,8 @@ export async function get( circularId: number, version?: number ): Promise { + if (isNaN(circularId) || (version !== undefined && isNaN(version))) + throw new Response(null, { status: 404 }) const circularVersions = await getDynamoDBVersionAutoIncrement(circularId) const result = await circularVersions.get(version) if (!result) @@ -367,6 +369,7 @@ export async function putVersion( * @returns an array of previous versions of a Circular sorted by version */ export async function getVersions(circularId: number): Promise { + if (isNaN(circularId)) throw new Response(null, { status: 404 }) const circularVersionsAutoIncrement = await getDynamoDBVersionAutoIncrement(circularId) return await circularVersionsAutoIncrement.list()