python / python/cpython

standard library email.parser fails to recognize multipart message

Aperta
#135,854 7 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stdlib topic-email type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la mailbox message-error.txt fornita e lo snippet email.parser Parser, quindi esamina la gestione dei boundary multipart nella libreria standard. Esamina la PR collegata gh-135891 per il lavoro già in corso. Il lavoro è completato quando l’esempio viene riconosciuto come multipart e msg.is_multipart() restituisce True.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.