Skip to content

mime: we don't decode quoted-printable #4411

@bradfitz

Description

@bradfitz
App Engine has a current production bug where long text values (non-file parts) of blob
uploads are sent from Google's MIME encoder to the user's HTTP handler, with the MIME
bodies re-encoded as quoted-printable.

Go's mime/multipart package does not decode quoted-printable.

Demo: http://bradgaetest.appspot.com/

The bytes sent to the handler are:

"--0016e68ee29c5d515f04cedf6733\r\nContent-Type: text/plain;
charset=ISO-8859-1\r\nContent-Disposition: form-data;
name=text\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\nwords words words words
words words words words words words words words wor=\r\nds words words words words words
words words words words words words words =\r\nwords words words words words words words
words words words words words wor=\r\nds words words words words words words words words
words words words words =\r\nwords words words words words words words words
words\r\n--0016e68ee29c5d515f04cedf6733\r\nContent-Type: text/plain;
charset=ISO-8859-1\r\nContent-Disposition: form-data;
name=submit\r\n\r\nSubmit\r\n--0016e68ee29c5d515f04cedf6733--"

That was captured with:

        var buf bytes.Buffer
        r.Body = ioutil.NopCloser(io.TeeReader(r.Body, &buf))
    _, other, err := blobstore.ParseUpload(r)

I propose adding a non-exported quotedPrintableReader to the multipart package for now,
so this could be cherry-picked into production, but perhaps later we should move the
reader type to the mime (not multipart) package, and then just use that reader from the
multipart package (it already depends on the mime package, so it wouldn't be a new
dependency).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions