The javamail provider should have a way to decode attachment names
------------------------------------------------------------------

                 Key: GERONIMO-4594
                 URL: https://issues.apache.org/jira/browse/GERONIMO-4594
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
            Reporter: Guillaume Nodet


Something has been written in the api, but not for the provider.
The IMAPMimeBodyPart code follows:

{code}
    public String getFileName() throws MessagingException {
        String filename = bodyStructure.disposition.getParameter("filename");
        if (filename == null) {
            filename = bodyStructure.mimeType.getParameter("name");
        }
        return filename;
    }
{code}

I think it should be more something like:

{code}
    public String getFileName() throws MessagingException {
        String filename = bodyStructure.disposition.getParameter("filename");
        if (filename == null) {
            filename = bodyStructure.mimeType.getParameter("name");
        }
        if (filename != null && 
SessionUtil.getBooleanProperty(MIME_DECODEFILENAME, false)) {
            try {
                filename = MimeUtility.decodeText(filename);
            } catch (UnsupportedEncodingException e) {
                throw new MessagingException("Unable to decode filename", e);
            }
        }
        return filename;
    }
{code}

With the MIME_DECODEFILENAME being the same property as in the 
javax.mail.internet.MimeBodyPart from the specs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to