mirror of
https://github.com/unraid/api.git
synced 2026-01-01 06:01:18 -06:00
feat: csv validation
This commit is contained in:
@@ -22,7 +22,23 @@ const RemoteConfigSchema = z.object({
|
|||||||
idtoken: z.string(),
|
idtoken: z.string(),
|
||||||
refreshtoken: z.string(),
|
refreshtoken: z.string(),
|
||||||
dynamicRemoteAccessType: z.nativeEnum(DynamicRemoteAccessType),
|
dynamicRemoteAccessType: z.nativeEnum(DynamicRemoteAccessType),
|
||||||
ssoSubIds: z.string(),
|
ssoSubIds: z
|
||||||
|
.string()
|
||||||
|
.transform((val) => {
|
||||||
|
// If valid, return as is
|
||||||
|
if (val === '' || val.split(',').every((id) => id.trim().match(/^[a-zA-Z0-9-]+$/))) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
// Otherwise, replace with an empty string
|
||||||
|
return '';
|
||||||
|
})
|
||||||
|
.refine(
|
||||||
|
(val) => val === '' || val.split(',').every((id) => id.trim().match(/^[a-zA-Z0-9-]+$/)),
|
||||||
|
{
|
||||||
|
message:
|
||||||
|
'ssoSubIds must be empty or a comma-separated list of alphanumeric strings with dashes',
|
||||||
|
}
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
const LocalConfigSchema = z.object({});
|
const LocalConfigSchema = z.object({});
|
||||||
|
|||||||
Reference in New Issue
Block a user