Skip to content

fix(feishu): recover mojibake filenames from Content-Disposition#72388

Merged
vincentkoc merged 1 commit into
mainfrom
clownfish/ghcrawl-199239-agentic-merge
Apr 28, 2026
Merged

fix(feishu): recover mojibake filenames from Content-Disposition#72388
vincentkoc merged 1 commit into
mainfrom
clownfish/ghcrawl-199239-agentic-merge

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

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

  • Keep the repair scoped to extensions/feishu/src/media.ts and focused tests.
  • Apply recovery only to header-derived plain filename= values, after the existing RFC 5987 filename*=UTF-8''... path.
  • Add regression coverage for the reported Chinese filename examples and for valid Latin-1-looking names that must not be rewritten.
  • Avoid speculative repair of JSON-derived file_name fields 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:changed

ProjectClownfish replacement details:

@greptile-apps

greptile-apps Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a targeted mojibake recovery path for CJK filenames in Feishu's Content-Disposition: filename= headers, where Node.js's HTTP layer exposes raw UTF-8 bytes through Latin-1 decoding. The fix re-encodes the plain-filename string through Latin-1 bytes back to UTF-8, guarded by a U+FFFD check and a CJK script presence check, and applies only to header-derived filenames — leaving JSON-sourced file_name fields untouched.

Confidence Score: 4/5

Safe 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 AI
This 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

Comment thread extensions/feishu/src/media.ts Outdated
@vincentkoc vincentkoc added the clawsweeper Tracked by ClawSweeper automation label Apr 27, 2026
@vincentkoc
vincentkoc force-pushed the clownfish/ghcrawl-199239-agentic-merge branch from 1a80843 to c8c7c52 Compare April 28, 2026 05:22
@vincentkoc
vincentkoc merged commit 4c72e60 into main Apr 28, 2026
57 checks passed
@vincentkoc
vincentkoc deleted the clownfish/ghcrawl-199239-agentic-merge branch April 28, 2026 05:23
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
@clawsweeper clawsweeper Bot mentioned this pull request Jul 1, 2026
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu clawsweeper Tracked by ClawSweeper automation maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant