commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olaf Kaus <olaf.k...@gmail.com>
Subject Re: [email] Problem parsing EMail-Attachmentfilename (ISO-8859-15)
Date Fri, 02 Aug 2013 15:35:45 GMT
Hi Thomas,

now I can reproduce this bug. I use the same environment as the customer
does (Thunderbird and rawtext with iso-encoding).
So I created the JIRA-ISSUE:
EMAIL-130<https://issues.apache.org/jira/browse/EMAIL-130>

Kind regards,
Olaf


2013/8/2 Thomas Neidhart <thomas.neidhart@gmail.com>

> Hi Olaf,
>
> you could also strip all sensitive information from the raw email, just the
> relevant headers are interesting for a unit test.
>
> Thanks,
>
> Thomas
>
>
> On Fri, Aug 2, 2013 at 4:54 PM, Olaf Kaus <olaf.kaus@gmail.com> wrote:
>
> > Hi Thomas,
> >
> > thanks for your fast answer. Jap, my solution only fix the
> ISO-Format....I
> > can create an issue, but I can't attach the original email because it's a
> > customer email with contract-data.
> > I try to reproduce this bug with an other email.If a had success, I
> create
> > an issue in the tracking system.
> >
> > Regard
> > Olaf K.
> >
> >
> > 2013/8/2 Thomas Neidhart <thomas.neidhart@gmail.com>
> >
> > > Dear Olaf,
> > >
> > > it looks like that the filename in the data source is not properly
> > > extracted.
> > > Your change would work for ISO-8859-15 encoded filenames but maybe not
> > for
> > > other encodings, so we should fix this in a general way.
> > >
> > > Could you please create an issue on the bug tracker
> > > https://issues.apache.org/jira/browse/EMAIL and attach an example raw
> > mail
> > > which illustrates the problem?
> > >
> > > Thanks,
> > >
> > > Thomas
> > >
> > >
> > >
> > > On Fri, Aug 2, 2013 at 3:48 PM, Olaf Kaus <olaf.kaus@gmail.com> wrote:
> > >
> > > > Hi,
> > > > first: Thank you for your good work!
> > > >
> > > > I use common-email-1.3.1 to parse emails from a imap-server.
> > > > After parsing an email with an pdf-attachment I received the
> following
> > > > attachment-filename:
> > > > ISO-8859-15''%5A%E4%68%6C%65%72%73%74%61%6E%64%73%6D%69%74%74
> > > > But the filename should be “Zählerstandsmitteilung_06_13.pdf”.
> > > >
> > > > I discovered the sourcecode and change the method
> > > > MimeMessageParser.getDataSourceName() as follows:
> > > >
> > > >
> > > > protected String getDataSourceName(Part part, DataSource dataSource)
> > > throws
> > > > MessagingException, UnsupportedEncodingException {
> > > > String result = dataSource.getName();
> > > >
> > > > if (result == null || result.length() == 0) {
> > > > result = part.getFileName();
> > > > }
> > > >
> > > > if (result != null && result.length() > 0) {
> > > > result = MimeUtility.decodeText(result);
> > > > } else {
> > > > result = null;
> > > > }
> > > > // NEW-Start
> > > > // result could be =
> > > > ISO-8859-15''%5A%E4%68%6C%65%72%73%74%61%6E%64%73%6D%69%74%74
> > > > if (result.indexOf("%") != -1) {
> > > > String rawContentType = part.getContentType();
> > > > // extract the name from contenttype:
> > > >
> > > >
> > >
> >
> application/pdf;\n\rname="=?ISO-8859-15?Q?Z=E4hlerstandsmitteilung=5F06=5F13=2Epdf?="
> > > > int nameIndex = rawContentType.indexOf("name=\"");
> > > > if (nameIndex != -1) {
> > > > rawContentType = rawContentType.substring(nameIndex);
> > > > rawContentType =
> rawContentType.substring(rawContentType.indexOf('"') +
> > > 1,
> > > > rawContentType.lastIndexOf('"'));
> > > > // ISO-Decoding
> > > > if (rawContentType.startsWith("=?") ||
> rawContentType.endsWith("?=")) {
> > > > result = MimeUtility.decodeText(rawContentType);
> > > > }
> > > > }
> > > > }
> > > > // NEW-END
> > > >
> > > > return result;
> > > > }
> > > >
> > > > Please, can you check the solution and maybe fix this behavior in the
> > > next
> > > > version.
> > > >
> > > > Thanks in advance
> > > > Olaf K.
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message