fix(api): filter empty/invalid screenshot IDs before ANY query
The PATCH /api/performance/:id/edit endpoint was passing raw removedScreenshotIds from the client to an = ANY() SQL clause. Empty strings or invalid values would crash the query. Added a filter to ensure only non-empty string IDs are used.
This commit is contained in:
@@ -403,9 +403,9 @@ export const performanceVerifyRoutes = new Elysia({
|
||||
.returning()
|
||||
|
||||
// ── Remove screenshots marked for deletion ────────────────────────
|
||||
const removedIds: string[] = Array.isArray(payload.removedScreenshotIds)
|
||||
? payload.removedScreenshotIds
|
||||
: []
|
||||
const removedIds: string[] = (Array.isArray(payload.removedScreenshotIds)
|
||||
? payload.removedScreenshotIds.filter((id: unknown) => typeof id === "string" && id.length > 0)
|
||||
: [])
|
||||
|
||||
if (removedIds.length > 0) {
|
||||
// Fetch storage keys before deleting rows
|
||||
|
||||
Reference in New Issue
Block a user