Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-4594

The javamail provider should have a way to decode attachment names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • mail
    • Security Level: public (Regular issues)
    • None

    Description

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

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

      I think it should be more something like:

          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;
          }
      

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

      Attachments

        Activity

          People

            salyh Hendrik Saly
            gnodet Guillaume Nodet
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: