Repository navigation
Fix: decode error in email parser app - #10920
Merged
KevinHuSh merged 1 commit intoNov 3, 2025
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Fix: UnicodeDecodeError: 'gb2312' codec can't decode byte 0xab in position 560: illegal multibyte sequence.
Type of change