email.get_filename() with newline

  • Thread starter Thomas Guettler
  • Start date
T

Thomas Guettler

Hi,

if I use part.get_filename() with the following email part:

------_=_NextPart_001_01C81B11.52AB8006
Content-Type: application/vnd.ms-excel;
name="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_enviaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Disposition: attachment;
filename="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_enviaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Description: =?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_enviaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?=
Content-Transfer-Encoding: base64

0M8R4KGxGu...

I get a filename which includes a newline character and the ?iso... encoding
is not resolved. But the mail user agent "mutt" does display the filename
correct. I tried it with the latest email packages (4.0.2).

Any hints how to parse this filename?

Thomas
 
G

Gabriel Genellina

if I use part.get_filename() with the following email part:

------_=_NextPart_001_01C81B11.52AB8006
Content-Type: application/vnd.ms-excel;
name="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_enviaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Disposition: attachment;
filename="=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_enviaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?="
Content-Description:
=?iso-8859-1?Q?30102007=28aktualisiert=29=5FK=FCndigungen_enviaM=5FErdgas?=
=?iso-8859-1?Q?_S=FCds__GmbH=2Exls?=
Content-Transfer-Encoding: base64

0M8R4KGxGu...

I get a filename which includes a newline character and the ?iso...
encoding
is not resolved. But the mail user agent "mutt" does display the filename
correct. I tried it with the latest email packages (4.0.2).

According to RFC2047, section 5:

+ An 'encoded-word' MUST NOT appear within a 'quoted-string'.

+ An 'encoded-word' MUST NOT be used in parameter of a MIME
Content-Type or Content-Disposition field, or in any structured
field body except within a 'comment' or 'phrase'.

so the above headers are invalid.
Any hints how to parse this filename?

You may try joining the lines and unfolding them by hand, and perhaps then
you could convince the decode_header function to work in this case...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top