diff --git a/ui/src/components/certimate/DeployToTencentCOS.tsx b/ui/src/components/certimate/DeployToTencentCOS.tsx index 2704ac1c..645b9c30 100644 --- a/ui/src/components/certimate/DeployToTencentCOS.tsx +++ b/ui/src/components/certimate/DeployToTencentCOS.tsx @@ -46,6 +46,21 @@ const DeployToTencentCOS = () => { } }, []); + useEffect(() => { + const regionResp = regionSchema.safeParse(data.config?.bucket); + if (!regionResp.success) { + setError({ + ...error, + region: JSON.parse(regionResp.error.message)[0].message, + }); + } else { + setError({ + ...error, + region: "", + }); + } + }, []); + useEffect(() => { if (!data.id) { setDeploy({ @@ -63,10 +78,14 @@ const DeployToTencentCOS = () => { message: t("common.errmsg.domain_invalid"), }); - const bucketSchema = z.string().min(1, { + const regionSchema = z.string().regex(/^ap-[a-z]+$/, { message: t("domain.deployment.form.cos_region.placeholder"), }); + const bucketSchema = z.string().regex(/^.+-\d+$/, { + message: t("domain.deployment.form.cos_bucket.placeholder"), + }); + return (