python / python/cpython

standard library email.parser fails to recognize multipart message

Aberta
#135,854 7 comentários 1 reação 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

stdlib topic-email type-bug
Linguagem predominante
Python
Estrelas
77.2k
Forks
36k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

Bug report

Bug description:

If an email message with attachments contain a boundary with the characters "<--- ... --->" the email.parser module fails to recognize the message as being multipart.

I have attached to this bug report an example mailbox file, and when the following snippet is run on it you will see that is_multipart() returns False, although the message is clearly a multipart message.

I found this boundary string used in a real life email I received.

from email.parser import Parser

# Create parser instance
P = Parser()

with open("message-error.mbox") as f:
    msg = P.parse(f)

print(msg.is_multipart())

message-error.txt

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs
  • gh-135891

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece com a caixa de correio message-error.txt fornecida e o snippet email.parser Parser; em seguida, inspecione o tratamento de limites multipart na biblioteca padrão. Revise o PR vinculado gh-135891 sobre o trabalho já em andamento. Está concluído quando o exemplo é reconhecido como multipart e msg.is_multipart() retorna True.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
backend
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
30/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.