Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1e8426b
feat(mail): add large attachment support via medias/upload API
chanthuang Apr 14, 2026
2514285
refactor(mail): remove legacy size check, add 3GB limit, integrate +send
chanthuang Apr 14, 2026
50087d6
feat(mail): quote-aware HTML insertion, +draft-edit support, cleanup …
chanthuang Apr 14, 2026
db1b9a1
fix(mail): align large attachment HTML IDs with desktop client
chanthuang Apr 15, 2026
724b6ce
docs(mail): document large attachment behavior in skill references
chanthuang Apr 15, 2026
4f724bb
fix(mail): pass signature-injected HTML to processLargeAttachments
chanthuang Apr 15, 2026
587a289
fix(mail): skip draft.Apply when all ops consumed by large attachment…
chanthuang Apr 15, 2026
0eaa6db
fix(mail): add X-Lms-Large-Attachment-Ids header in draft-edit large …
chanthuang Apr 16, 2026
6207b80
fix(mail): i18n large attachment HTML text aligned with desktop client
chanthuang Apr 16, 2026
a87692a
fix(mail): insert large attachment card before quote wrapper, not ins…
chanthuang Apr 16, 2026
a9b9551
feat(mail): unify large attachment handling in +draft-edit with norma…
chanthuang Apr 17, 2026
406f8fb
fix(mail): place signature before large attachment card consistently
chanthuang Apr 17, 2026
87a0464
fix(mail): auto-preserve signature in set_body and set_reply_body
chanthuang Apr 17, 2026
8ec9f38
fix(mail): use brand-aware display name in large attachment card title
chanthuang Apr 17, 2026
3f67194
style(mail): apply gofmt
chanthuang Apr 17, 2026
78da3d5
fix(mail): address review feedback on large attachment PR
chanthuang Apr 17, 2026
b2c6731
fix(mail): recognize server-format X-Lark-Large-Attachment header in …
chanthuang Apr 20, 2026
0cfbc62
fix(mail): skip large attachments in forward URL validation
chanthuang Apr 20, 2026
2fa08ef
fix(mail): classify forwarded original attachments for large attachme…
chanthuang Apr 20, 2026
1f71ff4
fix(mail): normalize large attachment header on draft edit to prevent…
chanthuang Apr 20, 2026
2fbef83
fix(mail): extract large attachment card from quote on forward
chanthuang Apr 20, 2026
322098c
fix(mail): use octet-stream for re-embedded attachments and file-base…
chanthuang Apr 20, 2026
868745f
fix(mail): address PR review — blocked extension bypass, index-based …
chanthuang Apr 20, 2026
b3f923d
fix(mail): preserve original content type for normal forwarded attach…
chanthuang Apr 20, 2026
84096f2
fix(mail): reconstruct missing large attachment HTML cards on draft edit
chanthuang Apr 20, 2026
0b7f6bc
feat(mail): support large attachments in plain-text emails
chanthuang Apr 20, 2026
15fb245
fix(mail): FindBodyPart skips attachment-disposition parts; update sk…
chanthuang Apr 20, 2026
2498aac
fix(mail): fix origIdx mismatch, predictable temp files, and attachme…
chanthuang Apr 20, 2026
c563c39
fix(mail): use composed body size and source inline bytes in EML size…
chanthuang Apr 20, 2026
53705c7
fix(mail): merge large attachment items into single container on draf…
chanthuang Apr 21, 2026
8084d39
fix(mail): strip large attachment card from reply/reply-all quote
chanthuang Apr 21, 2026
4124382
fix(mail): skip invalid attachments on forward instead of blocking
chanthuang Apr 21, 2026
cd8dada
fix(mail): restore dry-run file preflight and reserve card overhead i…
chanthuang Apr 21, 2026
57be277
fix(mail): revert classifier overhead reserve for simplicity
chanthuang Apr 21, 2026
c478a63
style(mail): fix gofmt indentation in draft create tests
chanthuang Apr 21, 2026
6f4e675
fix(mail): remove temp files in forward, use in-memory upload instead
chanthuang Apr 21, 2026
cab01a9
test(mail): add tests for validateComposeInlineAndAttachments and fil…
chanthuang Apr 21, 2026
912c8a3
test(mail): improve coverage for large attachment and draft edit func…
chanthuang Apr 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions shortcuts/common/drive_media_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
ParentType string
ParentNode *string
Extra string
// Reader, when non-nil, is used as the upload source instead of opening
// FilePath. Callers must set FileName and FileSize explicitly. The reader
// is NOT closed by UploadDriveMediaAll; the caller owns its lifetime.
Reader io.Reader
}

type DriveMediaMultipartUploadConfig struct {
Expand All @@ -49,11 +53,17 @@
}

func UploadDriveMediaAll(runtime *RuntimeContext, cfg DriveMediaUploadAllConfig) (string, error) {
f, err := runtime.FileIO().Open(cfg.FilePath)
if err != nil {
return "", WrapInputStatError(err)
var fileReader io.Reader
if cfg.Reader != nil {
fileReader = cfg.Reader

Check warning on line 58 in shortcuts/common/drive_media_upload.go

View check run for this annotation

Codecov / codecov/patch

shortcuts/common/drive_media_upload.go#L58

Added line #L58 was not covered by tests
} else {
f, err := runtime.FileIO().Open(cfg.FilePath)
if err != nil {
return "", WrapInputStatError(err)

Check warning on line 62 in shortcuts/common/drive_media_upload.go

View check run for this annotation

Codecov / codecov/patch

shortcuts/common/drive_media_upload.go#L62

Added line #L62 was not covered by tests
}
defer f.Close()
fileReader = f
}
defer f.Close()

fd := larkcore.NewFormdata()
fd.AddField("file_name", cfg.FileName)
Expand All @@ -65,7 +75,7 @@
if cfg.Extra != "" {
fd.AddField("extra", cfg.Extra)
}
fd.AddFile("file", f)
fd.AddFile("file", fileReader)

apiResp, err := runtime.DoAPI(&larkcore.ApiReq{
HttpMethod: http.MethodPost,
Expand Down
Loading
Loading