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:
2026-06-29 00:46:45 +08:00
parent 2303b9eb31
commit 60266ad9c9
+3 -3
View File
@@ -403,9 +403,9 @@ export const performanceVerifyRoutes = new Elysia({
.returning() .returning()
// ── Remove screenshots marked for deletion ──────────────────────── // ── Remove screenshots marked for deletion ────────────────────────
const removedIds: string[] = Array.isArray(payload.removedScreenshotIds) const removedIds: string[] = (Array.isArray(payload.removedScreenshotIds)
? payload.removedScreenshotIds ? payload.removedScreenshotIds.filter((id: unknown) => typeof id === "string" && id.length > 0)
: [] : [])
if (removedIds.length > 0) { if (removedIds.length > 0) {
// Fetch storage keys before deleting rows // Fetch storage keys before deleting rows