Upload rejection fails if email template parameters contain non-ASCII text

Bug #1910403 reported by Colin Watson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Ioana Lasc

Bug Description

https://answers.launchpad.net/launchpad/+question/694768 reports an upload that turned out to fail with OOPS-089a231f7518c189dcbda10e3ed6dce4 while attempting to send a rejection email. That OOPS reads:

  UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 10: ordinal not in range(128)

    Traceback (most recent call last):
  Module lp.archiveuploader.uploadprocessor, line 512, in process
    changes_file, self.processor.log))
  Module lp.archiveuploader.uploadprocessor, line 404, in processChangesFile
    upload.do_reject(notify)
  Module lp.archiveuploader.nascentupload, line 769, in do_reject
    changes_file_object=changes_file_object, logger=self.logger)
  Module lp.soyuz.model.queue, line 952, in notify
    mailer.sendAll()
  Module lp.services.mail.basemailer, line 236, in sendAll
    self.sendOne(email, recipient)
  Module lp.services.mail.basemailer, line 211, in sendOne
    ctrl = self.generateEmail(email, recipient)
  Module lp.soyuz.mail.packageupload, line 615, in generateEmail
    email, recipient, force_no_attachments=force_no_attachments)
  Module lp.services.mail.basemailer, line 114, in generateEmail
    body = self._getBody(email, recipient)
  Module lp.services.mail.basemailer, line 185, in _getBody
    body = template % params
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 10: ordinal not in range(128)

I've looked at the upload itself, and I think the problem here is that the Maintainer field has no email address, which causes parse_maintainer to return an error message as bytes rather than as text:

        m = re_parse_maintainer.match(maintainer)
        if not m:
            raise ParseMaintError(
                "%s: doesn't parse as a valid %s field."
                % (maintainer.encode("utf-8"), field_name))

I think that making the exception be text rather than bytes should fix this, but of course we'll need to reproduce this in the test suite first to confirm my analysis.

Related branches

Colin Watson (cjwatson)
Changed in launchpad:
status: Triaged → In Progress
assignee: nobody → Ioana Lasc (ilasc)
Colin Watson (cjwatson)
Changed in launchpad:
status: In Progress → Fix Committed
Colin Watson (cjwatson)
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.