Remove PGP inline armor headers

pull/146/head
M66B 6 years ago
parent d988f43e0b
commit 45016d8720

@ -999,11 +999,17 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
if (message.content) {
String body = message.read(context);
if (body != null) {
// https://tools.ietf.org/html/rfc4880#section-6.2
int begin = body.indexOf(PGP_BEGIN_MESSAGE);
int end = body.indexOf(PGP_END_MESSAGE);
if (begin >= 0 && begin < end) {
String section = body.substring(begin, end + PGP_END_MESSAGE.length());
section = section.replace("<br />", "\n\r");
String[] lines = section.split("<br />");
List<String> disarmored = new ArrayList<>();
for (String line : lines)
if (!TextUtils.isEmpty(line) && !line.contains(": "))
disarmored.add(line);
section = TextUtils.join("\n\r", disarmored);
inline = true;
encrypted = new ByteArrayInputStream(section.getBytes());

Loading…
Cancel
Save