DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=28476>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28476 HtmlEmail.embed problem Summary: HtmlEmail.embed problem Product: Commons Version: unspecified Platform: All URL: http://jakarta.apache.org/commons/sandbox/email/ OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Sandbox AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The method embed(URL url, String name)creates a String with the Content-ID of the embedded file. The id is generated by RandomStringUtils.randomAscii(10). The problem is that randomAscii() creates strings which contain sometimes double quotes. If you want to use this id inside a img tag in an HTML Email it might result in something like this: <img src:"cid:toW"q8mttc" >. The result is that the image wont be displayed because of the incorrect img tag. I think it would be better to user RandomStringUtils.randomAlphanumeric(10) as it doesnt generate double quotes. The patch is following if someone is interested: Index: HtmlEmail.java =================================================================== RCS file: /home/cvspublic/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/HtmlEmail.java,v retrieving revision 1.8 diff -u -r1.8 HtmlEmail.java --- HtmlEmail.java 19 Feb 2004 22:38:09 -0000 1.8 +++ HtmlEmail.java 19 Apr 2004 18:13:48 -0000 @@ -142,7 +142,8 @@ mbp.setDataHandler (new DataHandler(new URLDataSource(url))); mbp.setFileName(name); mbp.setDisposition("inline"); - String cid = RandomStringUtils.randomAscii(10); + // problem with double quotes when using randomAscii + String cid = RandomStringUtils.randomAlphanumeric(10); mbp.addHeader("Content-ID", cid); inlineImages.add(mbp); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
