LABKEY.Message.sendMessage HTML encoding bug | Will Holtz | 2016-01-19 11:37 | |||||||||||||||
Status: Closed | |||||||||||||||||
I just noticed that when I upgraded to v15.3 from v15.2, one of my calls to LABKEY.Message.sendMessage() had a significant change in output and seems to be broken. Here is some code that produces the output in question: <script type="text/javascript"> function getEmailAddress() { // Need a real user's email address due to labkey restrictions on email sending LABKEY.Query.selectRows({ schemaName: 'core', queryName: 'users', columns: ['email'], maxRows: 1, success: emailURL, failure: function() {alert('No emails found!');} }); } function emailURL(data, response) { var email = data.rows[0].Email; var url='http://www.labkey.org/'; var msgConfig = { msgFrom: email, msgSubject: 'Test of URL in HTML email', msgRecipients: [ LABKEY.Message.createRecipient(LABKEY.Message.recipientType.to, email) ], msgContent: [ LABKEY.Message.createMsgContent(LABKEY.Message.msgType.html, 'A test <a href="' + url + '">link</a> to labkey.org') ], failure: function(errorInfo, responseObj) { alert('Failed to send email. '+errorInfo.exception); } }; LABKEY.Message.sendMessage(msgConfig); } Ext4.onReady(function() { getEmailAddress(); }); </script> With v15.3 I get an email containing: Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit A test <a href="<a href="http://www.labkey.org/">link</a>">http://www.labkey.org/">link</a></a> to labkey.org I haven't run this exact code under v15.2 (as I don't have v15.2 handy anymore), but I have some old emails created by similar code on v15.2 and I believe the output from v15.2 would be: Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit A test <a href="http://www.labkey.org/">link</a> to labkey.org The message generated by v15.3 results in the follow DOM (using Chrome v47.0 and viewing the message in Gmail): A test <a href="<a href="http://www.labkey.org/%22%3Elink%3C/a%3E" target="_blank">http://www.labkey.org/"><wbr>link</a></a> to <a href="http://labkey.org" target="_blank">labkey.org</a> Which doesn't seem to be what I asked for in my call to LABKEY.Message.sendMessage. Let me know if that all makes sense. thanks, -Will |
|||||||||||||||||
| |||||||||||||||||