Archived
邮件契约修复:地址校验保持严格 z.email(),改测试夹具而非放宽生产 schema
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TM4kUBvekALu9qqmp7D3wr
This commit is contained in:
@@ -55,8 +55,7 @@ const accountCommon = {
|
||||
export const mailAccountInputSchema = z.discriminatedUnion('kind', [
|
||||
z.object({
|
||||
kind: z.literal('imap-smtp'),
|
||||
/** zod 默认 email 正则要求顶级域至少两个字母(`.c` 会被拒);邮箱地址理应更宽 —— 改用 html5Email 正则 */
|
||||
address: z.email({ pattern: z.regexes.html5Email }),
|
||||
address: z.email(),
|
||||
...accountCommon,
|
||||
settings: imapSmtpSettingsSchema.prefault({}),
|
||||
/** 只写不读:缺省 = 不改(与 LLM 密钥同款) */
|
||||
@@ -179,9 +178,9 @@ export const mailSendInputSchema = z.object({
|
||||
accountId: z.string().optional(),
|
||||
/** 指定发件地址(channel 用):必须对上一个已启用账号,不静默回落 */
|
||||
from: z.string().optional(),
|
||||
to: z.array(z.email({ pattern: z.regexes.html5Email })).min(1),
|
||||
cc: z.array(z.email({ pattern: z.regexes.html5Email })).default([]),
|
||||
bcc: z.array(z.email({ pattern: z.regexes.html5Email })).default([]),
|
||||
to: z.array(z.email()).min(1),
|
||||
cc: z.array(z.email()).default([]),
|
||||
bcc: z.array(z.email()).default([]),
|
||||
subject: z.string().min(1),
|
||||
text: z.string().optional(),
|
||||
html: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user