Skip to content

High performance self-hosted photo and video management solution.

fix(server): make "limit" paramter use z.coerce (#31899)

aviv926c9a3248d714c
diff --git a/e2e/src/specs/server/api/integrity.e2e-spec.ts b/e2e/src/specs/server/api/integrity.e2e-spec.ts
index cd2b946f4f..04fd46f929 100644
--- a/e2e/src/specs/server/api/integrity.e2e-spec.ts
+++ b/e2e/src/specs/server/api/integrity.e2e-spec.ts
@@ -427,7 +427,7 @@ describe('/admin/integrity', () => {
await utils.waitForQueueFinish(admin.accessToken, QueueName.IntegrityCheck);
const { status, body } = await request(app)
- .get('/admin/integrity/report?type=missing_file')
+ .get('/admin/integrity/report?type=missing_file&limit=5')
.set('Authorization', `Bearer ${admin.accessToken}`)
.send();
diff --git a/server/src/dtos/integrity.dto.ts b/server/src/dtos/integrity.dto.ts
index df616370fa..6f376a01b2 100644
--- a/server/src/dtos/integrity.dto.ts
+++ b/server/src/dtos/integrity.dto.ts
@@ -14,7 +14,7 @@ const IntegrityGetReportSchema = z
.object({
type: IntegrityReportSchema,
cursor: z.string().optional().describe('Cursor for pagination'),
- limit: z.int().positive().default(500).optional().describe('Number of items per page'),
+ limit: z.coerce.number().int().positive().default(500).optional().describe('Number of items per page'),
})
.meta({ id: 'IntegrityGetReportDto' });