#89 Hide PGP SIGNATURE from cleartext signed messages

This commit is contained in:
the-djmaze 2022-02-02 18:43:55 +01:00
parent e43c5e6d82
commit 6b2311663b
2 changed files with 10 additions and 4 deletions

View file

@ -461,12 +461,16 @@ export class MessageModel extends AbstractModel {
if (body && this.plain()) {
body.classList.toggle('html', 0);
body.classList.toggle('plain', 1);
body.innerHTML = plainToHtml(this.plain())
body.innerHTML = plainToHtml(
this.plain()
.replace(/-----BEGIN PGP SIGNATURE-----[\s\S]*/, '')
.replace(/-----BEGIN PGP SIGNED MESSAGE-----(\r?\n[a-z][^\r\n]+)+/i, '')
.trim()
)
// Strip utm_* tracking
.replace(/(\\?|&|&)utm_[a-z]+=[a-z0-9_-]*/si, '$1')
.replace(/(\?|&|&)utm_[a-z]+=[^?&#]*/si, '$1')
.replace(url, '$1<a href="$2" target="_blank">$2</a>')
.replace(email, '$1<a href="mailto:$2">$2</a>');
this.isHtml(false);
this.hasImages(false);
this.initView();