Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Delete array/brackets in /v2/secrets DELETE route

Tuan Dangcc46b575b7b7
diff --git a/backend/src/routes/v2/secrets.ts b/backend/src/routes/v2/secrets.ts
index 1f68d44203..29eac042fe 100644
--- a/backend/src/routes/v2/secrets.ts
+++ b/backend/src/routes/v2/secrets.ts
@@ -137,24 +137,22 @@ router.patch(
router.delete(
'/',
- [
- body('secretIds')
- .exists()
- .custom((value) => {
- // case: delete 1 secret
- if (typeof value === 'string') return true;
-
- if (Array.isArray(value)) {
- // case: delete multiple secrets
- if (value.length === 0) throw new Error('secrets cannot be an empty array');
- return value.every((id: string) => typeof id === 'string')
- }
-
- throw new Error('secretIds must be a string or an array of strings');
- })
- .not()
- .isEmpty()
- ],
+ body('secretIds')
+ .exists()
+ .custom((value) => {
+ // case: delete 1 secret
+ if (typeof value === 'string') return true;
+
+ if (Array.isArray(value)) {
+ // case: delete multiple secrets
+ if (value.length === 0) throw new Error('secrets cannot be an empty array');
+ return value.every((id: string) => typeof id === 'string')
+ }
+
+ throw new Error('secretIds must be a string or an array of strings');
+ })
+ .not()
+ .isEmpty(),
validateRequest,
requireAuth({
acceptedAuthModes: ['jwt']