fix(feishu): decode RFC 5987 filename for file downloads#43983
fix(feishu): decode RFC 5987 filename for file downloads#43983guang384 wants to merge 32 commits into
Conversation
Fixes openclaw#43840 - Add decodeRfc5987Filename() to decode percent-encoded filenames - Apply to file message display (line 437) - Apply to file download metadata (line 539)
Greptile SummaryThis PR adds a All issues raised in previous review rounds have been addressed in this revision:
The CHANGELOG entry wording ("instead of using RFC 5987 format") is slightly imprecise — the implementation supports RFC 5987 in addition to plain URL-encoded names — but this is a cosmetic concern and does not affect correctness. Confidence Score: 5/5
Last reviewed commit: 734171e |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88320de187
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
ademczuk
left a comment
There was a problem hiding this comment.
Thanks for tackling the Feishu non-ASCII filename display issue. The problem is real and affects users with CJK filenames.
A few things to flag:
1. Stronger competing PR exists
#43916 by @ccsang addresses the same bug with a more comprehensive approach: exported/testable decoder function, 8 tests, CHANGELOG entry, and fixes across both bot.ts and media.ts (upload side as well as display). It also covers the UI tool cards. Given that #43916 is further along, it might be worth coordinating with that PR rather than duplicating effort.
2. The filename*=UTF-8'' prefix check is likely dead code
Feishu's JSON payloads send file_name as plain encodeURIComponent output (e.g. %E6%B5%8B%E8%AF%95.pdf), not the RFC 5987 format (filename*=UTF-8''%E6%B5%8B%E8%AF%95.pdf). RFC 5987 is an HTTP header encoding format, not a JSON payload format. The startsWith("filename*=UTF-8''") branch will never trigger for real Feishu messages, making that path dead code. The function should likely just call decodeURIComponent directly.
3. Missing try/catch around decodeURIComponent
decodeURIComponent throws URIError on malformed percent-encoded strings (e.g. truncated %E6%). In parseMediaKeys, the outer try/catch returns {} on any error, which would silently drop the fileKey and break file downloads for an otherwise valid file. A try/catch inside the decoder with a fallback to the raw string would be safer.
4. Function is private
decodeRfc5987Filename is scoped as a module-private function in bot.ts, which makes it impossible to unit test directly. Exporting it (as #43916 does) would allow focused tests.
5. No tests or CHANGELOG
Both are expected for user-facing bug fixes per CONTRIBUTING.md.
The core idea is sound. If #43916 stalls, addressing the points above would make this a solid alternative.
- Remove dead RFC 5987 code path (not used by Feishu JSON) - Add try/catch for decodeURIComponent to prevent crashes - Export function for unit testing - Add CHANGELOG entry
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b493b2e5c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 821a262e2e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@greptileai review |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 415fa98b90
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d006d11f7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c49d3624b9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@greptileai review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7231b0d531
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@greptileai review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@greptileai review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@greptileai review |
|
Thanks @ademczuk for the review! I've addressed all the Greptile feedback and the PR now has a 5/5 confidence score. The fix:
I saw #43916 by @ccsang - that's a comprehensive solution too! Would be great to get either this or #43916 merged to fix the non-ASCII filename issue. Thanks! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39e8811a3d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d6839ccda
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Closing this as implemented after Codex review. Current What I checked:
So I’m closing this as already implemented rather than keeping a duplicate issue open. Review notes: reviewed against 50e36983bb2d; fix evidence: release v2026.3.12. |
Summary
Fixes #43840
Problem
When sending files with non-ASCII filenames (Chinese, Japanese, emoji) in Lark/Feishu, the filename appears URL-encoded (e.g., %E6%B5%8B%E8%AF%95.txt instead of 测试.txt).
Root Cause
The backend receives the Content-Disposition header with RFC 5987 encoded filename (filename*=UTF-8...) but fails to decode it using decodeURIComponent before storing/displaying.
Changes
Test