commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30634] New: - [email] Issue with cid URLs generated by .embed(...) in HtmlEmail.java
Date Thu, 12 Aug 2004 20:41:41 GMT
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=30634>.
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=30634

[email] Issue with cid URLs generated by .embed(...) in HtmlEmail.java

           Summary: [email] Issue with cid URLs generated by .embed(...) in
                    HtmlEmail.java
           Product: Commons
           Version: 1.0 Alpha
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: tvcom@web.de
                CC: tvcom@web.de


There seems to be an issue with the content-id (cid) returned by the 
.embed(...) member in HtmlEmail.java. The function sometimes returns cids 
with may also contain single quotes ' or double quotes " (all within ascii 
range 32-126). These random strings break the HTML code when a cid is 
referenced in an img-tag, e.g. <img src="cid:hju4"4u23">. Since this is a 
random function, it only happens from time to time. Tests with Outlook, 
Lotus Notes and Apple Mail clients show that they cannot render those 
images, because their html parser only returns a portion of the actual cid.
I have tried to encode the cid (with commons URLCodec), but that doesn't work
either.

Fixed it by using RandomStringUtils.randomAlphabetic(...) in the .embed() 
function in HtmlEmail.java, instead of .randomAscii(...). Could also be 
fixed by using a combination of .randomNumeric(...) + 
.randomAlphabetic(...), but the result should not contain url-offending 
characters :) Also consider to use the commons-id package as soon as it is 
stable.

This patch works for me so far:

% cvs diff HtmlEmail.java

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 -r1.8 HtmlEmail.java
145c145
<         String cid = RandomStringUtils.randomAscii(10);
---
>         String cid = RandomStringUtils.randomAlphabetic(10);

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message