fix(feishu): recover mojibake filenames from Content-Disposition#72388
Conversation
Greptile SummaryThis PR adds a targeted mojibake recovery path for CJK filenames in Feishu's Confidence Score: 4/5Safe to merge; the recovery is narrowly scoped to CJK-containing header filenames and has solid guard conditions preventing false positives. No P0 or P1 issues found. Logic is correct: the latin1→utf8 round-trip, U+FFFD guard, and CJK-presence check together make false positives very unlikely. Tests cover the three critical cases (CJK recovery, valid Latin-1 passthrough, JSON-derived passthrough). Minor naming note only. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/feishu/src/media.ts
Line: 149-151
Comment:
**Function name doesn't match its scope**
`containsCjkText` tests for Han, Hiragana, Katakana, and Hangul, but "CJK" conventionally refers only to the unified ideograph block (Han characters), not the Japanese kana syllabaries. A caller reading the name would not expect it to match a purely hiragana or katakana filename. Consider `containsCjkOrKanaText` or a broader `containsEastAsianText` to avoid surprising future readers.
```suggestion
function containsEastAsianText(value: string): boolean {
return /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(value);
}
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(feishu): recover mojibake filenames ..." | Re-trigger Greptile |
1a80843 to
c8c7c52
Compare
Summary
Repair the canonical Feishu filename mojibake fix from #48578 so Chinese/CJK filenames received through plain
Content-Disposition: filename=headers are recovered from UTF-8 bytes that Node exposed through Latin-1 header decoding.Plan
extensions/feishu/src/media.tsand focused tests.filename=values, after the existing RFC 5987filename*=UTF-8''...path.file_namefields unless a concrete Feishu SDK bug is separately proven.Credit
Based on #48578 by @alex-xuweilong. Also preserves useful test and review context from #50435 by @lishuaigit and #59431 by @DoChaoing.
Validation
pnpm check:changedProjectClownfish replacement details: