fix(admin): preserve saved SMTP TLS mode in test endpoints - #6357
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
POST /api/v1/admin/settings/test-smtp在请求未携带smtp_use_tls时,会把零值false当作显式配置,覆盖已保存的隐式 TLS 设置。保存为 465 + TLS 的配置因此走错明文/STARTTLS 路径并可能超时。相同的遗漏语义也存在于send-test-email。根因
两个请求结构都使用普通
bool,JSON 绑定后无法区分“字段未提供”和“显式 false”;处理器虽然会回填其他 SMTP 字段,却直接使用该布尔零值。改动
smtp_use_tls改为可选布尔值。UseTLS;显式true或false仍以请求为准。验证
重复/重叠检查:提交前未发现引用 #6354 或修复 test-smtp 的 smtp_use_tls 省略语义的开放 PR。
Fixes #6354