Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email: ContentManager.set_content calls nonexistent method encode() on bytes #85574

Closed
joreiff mannequin opened this issue Jul 26, 2020 · 9 comments
Closed

email: ContentManager.set_content calls nonexistent method encode() on bytes #85574

joreiff mannequin opened this issue Jul 26, 2020 · 9 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes topic-email

Comments

@joreiff
Copy link
Mannequin

joreiff mannequin commented Jul 26, 2020

BPO 41402
Nosy @warsaw, @bitdancer, @ambv, @miss-islington, @joreiff
PRs
  • bpo-41402: Fix email ContentManager calling .encode() on bytes #21631
  • [3.10] bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631) #27686
  • [3.9] bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631) #27687
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-08-10.07:52:58.446>
    created_at = <Date 2020-07-26.17:59:16.166>
    labels = ['3.11', 'expert-email', '3.10', '3.9']
    title = 'email: ContentManager.set_content calls nonexistent method encode() on bytes'
    updated_at = <Date 2021-08-10.07:52:58.446>
    user = 'https://github.com/joreiff'

    bugs.python.org fields:

    activity = <Date 2021-08-10.07:52:58.446>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-08-10.07:52:58.446>
    closer = 'lukasz.langa'
    components = ['email']
    creation = <Date 2020-07-26.17:59:16.166>
    creator = 'joreiff'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41402
    keywords = ['patch']
    message_count = 9.0
    messages = ['374337', '374641', '374667', '376109', '386596', '399278', '399292', '399297', '399301']
    nosy_count = 6.0
    nosy_names = ['barry', 'r.david.murray', 'lukasz.langa', 'python-dev', 'miss-islington', 'joreiff']
    pr_nums = ['21631', '27686', '27687']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue41402'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @joreiff
    Copy link
    Mannequin Author

    joreiff mannequin commented Jul 26, 2020

    If assigning binary content to an EmailMessage via set_content(), the function email.contentmanager.set_bytes_content() is called. This function fails when choosing the 7bit transfer encoding because of a call to data.decode('ascii').

    @joreiff joreiff mannequin added 3.8 only security fixes 3.10 only security fixes 3.9 only security fixes topic-email labels Jul 26, 2020
    @bitdancer
    Copy link
    Member

    The fix looks good to me. Don't know how I made that mistake, and obviously I didn't write a test for it...

    @joreiff
    Copy link
    Mannequin Author

    joreiff mannequin commented Aug 1, 2020

    Thanks! Is there anything I need to do regarding the Python 3.8 and 3.9 backports?

    @joreiff
    Copy link
    Mannequin Author

    joreiff mannequin commented Aug 30, 2020

    It has been almost a month since the last update, so pinging as suggested in the Developer's Guide. Do I need to do something before the PR can be merged?

    @joreiff
    Copy link
    Mannequin Author

    joreiff mannequin commented Feb 7, 2021

    Could someone comment on the way forward? Or ideally just merge my PR (it was approved on GitHub)? I am still very much interested in this bug getting fixed.

    @ambv ambv added 3.11 only security fixes and removed 3.8 only security fixes labels Aug 9, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Aug 9, 2021

    New changeset b33186b by Johannes Reiff in branch 'main':
    bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631)
    b33186b

    @ambv
    Copy link
    Contributor

    ambv commented Aug 9, 2021

    New changeset 395f4c7 by Miss Islington (bot) in branch '3.9':
    bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631) (GH-27687)
    395f4c7

    @miss-islington
    Copy link
    Contributor

    New changeset a3185da by Miss Islington (bot) in branch '3.10':
    bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631)
    a3185da

    @ambv
    Copy link
    Contributor

    ambv commented Aug 10, 2021

    Thanks, Johannes! ✨ 🍰 ✨

    @ambv ambv closed this as completed Aug 10, 2021
    @ambv ambv closed this as completed Aug 10, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes topic-email
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants