附图 base64 远超 64KiB 的质量编辑上限,被误判为无效设置并报“发送设置无效”。 改为 12MB 上限的通用解码,并返回明确的图片错误文案。
This commit is contained in:
@@ -192,8 +192,9 @@ func qaWeeklyMailImage(w http.ResponseWriter, r *http.Request, c Config) {
|
||||
var request struct {
|
||||
PNGBase64 string `json:"png_base64"`
|
||||
}
|
||||
if decodeQualityJSON(w, r, &request) != nil {
|
||||
weeklyMailError(w, qawemail.ErrInvalid)
|
||||
// The chart is megabytes of base64, far above the tiny quality-edit limit.
|
||||
if decodeGovernanceJSON(w, r, &request, 12<<20) != nil {
|
||||
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "看板图片数据无效或过大(上限 8MB)"})
|
||||
return
|
||||
}
|
||||
png, err := base64.StdEncoding.DecodeString(request.PNGBase64)
|
||||
|
||||
Reference in New Issue
Block a user