Attach a File with MailAttachment on Windows platform
-----------------------------------------------------

                 Key: MAGNOLIA-3597
                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3597
             Project: Magnolia
          Issue Type: Bug
    Affects Versions: 4.4.2
         Environment: Windows + JDK 1.6 + Tomcat 5.5
            Reporter: Vincent Gombert
            Assignee: Boris Kraft


Using constructor info.magnolia.module.mail.templates.MailAttachment(File, 
String, String, String) results to an UnknownHostException while java mail is 
trying to get the file on Windows.
The error comes from method MailAttachment.setPath(String) which constructs a 
URL with file:// + absolutePath. On *nix platforms it gives us a url like 
file:///tmp/myfile, but on Windows the url is file://C:/temp/myfile which is 
wrong (root slash is missing).
I'd fix this issue by changing URL construction to :
[143] this.url = new URL(FILE_URL_PREFIX + "/" + StringUtils.removeStart(aPath, 
"/"));
I tested this fix on both Debian and Windows platforms.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to