mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 09:27:50 +00:00
Update secret-router.ts
This commit is contained in:
@@ -194,16 +194,23 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
return metadata;
|
return metadata;
|
||||||
})
|
})
|
||||||
.superRefine((el, ctx) => {
|
.superRefine((metadata, ctx) => {
|
||||||
if (el && !Array.isArray(el)) {
|
if (metadata && !Array.isArray(metadata)) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: "Invalid secretMetadata format. Correct format is key1:value1,key2:value2"
|
message: "Invalid secretMetadata format. Correct format is key1:value1,key2:value2"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el) {
|
if (metadata) {
|
||||||
for (const item of el) {
|
if (metadata.length > 10) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: "You can only filter by up to 10 metadata fields"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of metadata) {
|
||||||
if (!item.key || !item.value) {
|
if (!item.key || !item.value) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
|
|||||||
Reference in New Issue
Block a user