I think I have found the cause if this issue. Using the example from comment 2, I can see the entire message was stored in the librarian properly. The message was then passes to the Bugs incoming mail handler, which created the comment and attachment. The rules to create the comment create a Message object which also represents the message parts (encoded attachments) as chunks. If the chunk's mime-type is text, the chunk is decoded and stripped so that in can be placed in the librarian in an easy form to view. This is the fragment in
if (mime_type == 'text/plain' and no_attachment
and part.get_filename() is None):
# Get the charset for the message part. If one isn't
# specified, default to latin-1 to prevent
# UnicodeDecodeErrors. charset = part.get_content_charset()
if charset is None or str(charset).lower() == 'x-unknown': charset = 'latin-1' content = self.decode(content, charset)
if content.strip(): MessageChunk( message=message, sequence=sequence, content=content) sequence += 1
I understand the desire to call strip for the sake of the the person looking at the file in a browser, but as this is a file attachment, the call to strip() is uncalled for.
I think I have found the cause if this issue. Using the example from comment 2, I can see the entire message was stored in the librarian properly. The message was then passes to the Bugs incoming mail handler, which created the comment and attachment. The rules to create the comment create a Message object which also represents the message parts (encoded attachments) as chunks. If the chunk's mime-type is text, the chunk is decoded and stripped so that in can be placed in the librarian in an easy form to view. This is the fragment in
if (mime_type == 'text/plain' and no_attachment
and part.get_filename() is None):
# Get the charset for the message part. If one isn't rors.
charset = part.get_ content_ charset( ) .lower( ) == 'x-unknown':
charset = 'latin-1'
content = self.decode( content, charset)
# specified, default to latin-1 to prevent
# UnicodeDecodeEr
if charset is None or str(charset)
if content.strip():
MessageCh unk(
message= message, sequence=sequence,
content= content)
sequence += 1
I understand the desire to call strip for the sake of the the person looking at the file in a browser, but as this is a file attachment, the call to strip() is uncalled for.