From 9fa28be312d77b4a852cc623cd6cc5049aae509e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=85=B4=E7=82=80?= Date: Fri, 26 Jun 2026 14:22:25 +0800 Subject: [PATCH] =?UTF-8?q?file=5Fcommon.go=20=E7=9A=84=203=20=E5=A4=84?= =?UTF-8?q?=E8=A3=B8=20fmt.Errorf=20=E5=B7=B2=E6=94=B9=E4=B8=BA=20typed=20?= =?UTF-8?q?errs.NewValidationError(errs.SubtypeInvalidArgument,=20...)(?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=E6=A0=A1=E9=AA=8C=E9=94=99?= =?UTF-8?q?=E8=AF=AF,=E5=BD=92=20validation)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shortcuts/apps/file_common.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shortcuts/apps/file_common.go b/shortcuts/apps/file_common.go index b9849d16f..a4b961e34 100644 --- a/shortcuts/apps/file_common.go +++ b/shortcuts/apps/file_common.go @@ -57,21 +57,21 @@ func normalizeTimestamp(raw string) (string, error) { if reTsDate.MatchString(s) { t, err := time.ParseInLocation("2006-01-02", s, time.Local) if err != nil { - return "", fmt.Errorf("invalid date %q", s) + return "", errs.NewValidationError(errs.SubtypeInvalidArgument, "invalid date %q", s) } return t.UTC().Format(time.RFC3339), nil } if reTsLocalDateTime.MatchString(s) { t, err := time.ParseInLocation("2006-01-02T15:04:05", s, time.Local) if err != nil { - return "", fmt.Errorf("invalid local datetime %q", s) + return "", errs.NewValidationError(errs.SubtypeInvalidArgument, "invalid local datetime %q", s) } return t.UTC().Format(time.RFC3339), nil } if t, err := time.Parse(time.RFC3339, s); err == nil { return t.UTC().Format(time.RFC3339), nil } - return "", fmt.Errorf("invalid timestamp %q (want relative 7d/2h/30s, date 2026-04-15, datetime 2026-04-15T10:00:00, or ISO 8601 with TZ)", s) + return "", errs.NewValidationError(errs.SubtypeInvalidArgument, "invalid timestamp %q (want relative 7d/2h/30s, date 2026-04-15, datetime 2026-04-15T10:00:00, or ISO 8601 with TZ)", s) } // newFileTransferClient 直传 / 直下对象存储 presigned URL 用(绕开 Lark 网关,无需 auth、无超时以容纳大文件)。