Skip to content

mime/multipart: add (*Reader).NextRawPart to avoid quoted-printable decoding #26803

@gbbr

Description

@gbbr

Based on documentation, (*Reader).NextPart should return the unmodified next part in a multipart message. Instead, it removes the Content-Transfer-Encoding header and decodes the body automatically when its value is quoted-printable.

This seems rather uncalled for, given that:

  • RFC 2045 Section 6.7 indicates: "[...] encoded in Quoted-Printable to ensure
    the integrity of the data [...]". The current behavior does not ensure integrity.
  • Users of this package could access the Content-Transfer-Encoding header themselves and use the already existent mime/quotedprintable package.

Because data integrity is breached, this pretty much renders it impossible to use the mime/multipart package to implement a reliable IMAP server.

The proposal suggests removing this functionality and preserving the unmodified header and body. Users will be able to decode such bodies themselves when necessary by reading the Content-Transfer-Encoding header and using the mime/quotedprintable package, while also having access to the original message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions