Skip to content

Fix: decode error in email parser app - #10920

Merged
KevinHuSh merged 1 commit into
infiniflow:mainfrom
yongtenglei:hotfix/decode_error_in_email_app
Nov 3, 2025
Merged

KevinHuSh merged 1 commit into
infiniflow:mainfrom
yongtenglei:hotfix/decode_error_in_email_app

Conversation

@yongtenglei

Copy link
Copy Markdown
Member

What problem does this PR solve?

Fix: UnicodeDecodeError: 'gb2312' codec can't decode byte 0xab in position 560: illegal multibyte sequence.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🌈 python Pull requests that update Python code 🐞 bug Something isn't working, pull request that fix bug. labels Oct 31, 2025
@KevinHuSh KevinHuSh added the ci Continue Integration label Nov 3, 2025
@KevinHuSh
KevinHuSh merged commit 4117f41 into infiniflow:main Nov 3, 2025
clifftseng pushed a commit to clifftseng/ragflow that referenced this pull request Feb 9, 2026
### What problem does this PR solve?

Fix: UnicodeDecodeError: 'gb2312' codec can't decode byte 0xab in
position 560: illegal multibyte sequence.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
JessYanCoding added a commit to JessYanCoding/ragflow that referenced this pull request Sep 14, 2026
Two regressions in Parser._email, the first masking the second.

_add_content recurses correctly but both leaf branches read the enclosing
msg instead of their own `m` parameter. get_payload(decode=True) on a
multipart container returns None, so None.decode(charset) raised
AttributeError for every multipart message -- including a plain+HTML mail
with no attachment. Single-part messages worked only because there msg is
the part. 061d8f7 (infiniflow#10901) introduced this while copying in the charset
fallback chain; the code it replaced read `m`.

Attachments were then force-decoded with part.get_content_charset(),
which is None for any binary part, and with a hardcoded utf-8 in the .msg
branch. Both raise. 7fb8b30 (infiniflow#10506) introduced both call sites; the
.msg line it replaced was annotated `# binary`. Attachments are in the
shipped default field list, so this was the default configuration.

Text attachments now go through the charset fallback chain infiniflow#10920 added
for rag/app/email.py, lifted to a method-level helper so the body and
attachment paths share it. Binary attachments keep their filename and
contribute no payload text; re-parsing their content by extension, as
rag/app/email.py and the Go parser both do, is infiniflow#6560 and out of scope.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration 🌈 python Pull requests that update Python code size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants