mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Fix up text/plain message view to escape < and > and & when converting plain text to html for display
This commit is contained in:
parent
0ffe1621a2
commit
d185adfc27
@ -1068,6 +1068,15 @@ public class MessageView extends Activity
|
||||
} else {
|
||||
Matcher m = Regex.WEB_URL_PATTERN.matcher(text);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
/*
|
||||
* Convert plain text to HTML by replacing
|
||||
* \r?\n with <br> and adding a html/body wrapper as well as escaping & < >
|
||||
*/
|
||||
text = text.replaceAll("&", "&");
|
||||
text = text.replaceAll("<", "<");
|
||||
text = text.replaceAll(">", ">");
|
||||
text = text.replaceAll("\r?\n", "<br>");
|
||||
|
||||
while (m.find()) {
|
||||
int start = m.start();
|
||||
if (start == 0 || (start != 0 && text.charAt(start - 1) != '@')) {
|
||||
@ -1079,12 +1088,6 @@ public class MessageView extends Activity
|
||||
}
|
||||
m.appendTail(sb);
|
||||
|
||||
/*
|
||||
* Convert plain text to HTML by replacing
|
||||
* \r?\n with <br> and adding a html/body wrapper.
|
||||
*/
|
||||
text = sb.toString().replaceAll("\r?\n", "<br>");
|
||||
|
||||
|
||||
|
||||
text = "<html><body>" + text + "</body></html>";
|
||||
|
Loading…
Reference in New Issue
Block a user