- Elide inline HTML MIME parts when there is a plaintext part available.
- Don't display S/MIME signatures [1]; reduce to the attachment link. - Make the self-referencing-URL removal regex case insensitive. Suggested by: gavin [1]
This commit is contained in:
parent
815ebf65a1
commit
f2ea3e0f43
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=37458
2 changed files with 56 additions and 4 deletions
|
@ -26,7 +26,7 @@
|
|||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.77 2011/07/21 12:37:17 shaun Exp $
|
||||
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.78 2011/07/21 14:31:41 shaun Exp $
|
||||
#
|
||||
# Useful PRs for testing:
|
||||
#
|
||||
|
@ -389,7 +389,7 @@ sub PrintPR
|
|||
|
||||
# Remove the URL, as it is merely clutter
|
||||
my $why = $item->why;
|
||||
$why =~ s/[\n\s]*\Q$selfurl\E[\n\s]*$//;
|
||||
$why =~ s/[\n\s]*\Q$selfurl\E[\n\s]*$//i;
|
||||
$item->why($why);
|
||||
|
||||
print $q->table({-class => 'auditblock', -cellspacing => '1'},
|
||||
|
@ -470,11 +470,56 @@ sub PrintPR
|
|||
my $mime_iter = GnatsPR::MIMEIterator->new($item);
|
||||
|
||||
while (my $part = $mime_iter->next()) {
|
||||
my $ctype = $part->header('content-type');
|
||||
my $elide = 0;
|
||||
|
||||
print $q->hr({-class => 'mimeboundary'})
|
||||
unless ($mime_iter->isfirst);
|
||||
|
||||
$part->isattachment
|
||||
and print AttachmentHeader($part->filename, ++$patchnum);
|
||||
and ++$patchnum;
|
||||
|
||||
# Skip (inline) HTML parts -- but only if we have
|
||||
# a plaintext part. We could possibly be a bit more
|
||||
# rigorous in verifying the existence of the latter,
|
||||
# but testing for the MIME header or other part will
|
||||
# suffice, as it is unlikely a HTML-only e-mail will
|
||||
# have more than that single part.
|
||||
if ($ctype eq 'text/html' && !$part->isattachment &&
|
||||
!$mime_iter->isfirst) {
|
||||
$elide = 1;
|
||||
|
||||
# S/MIME signatures - of questionable value here
|
||||
} elsif ($ctype eq 'application/pkcs7-signature') {
|
||||
$elide = 1;
|
||||
}
|
||||
|
||||
if ($elide) {
|
||||
if ($part->isattachment) {
|
||||
my $url = $q->url(-full => 1, -query => 1);
|
||||
|
||||
my $dlink =
|
||||
$q->a({-href => $url . '&getpatch=' . $patchnum},
|
||||
'[Download]');
|
||||
|
||||
print $q->div(
|
||||
{-class => 'elidemsg'},
|
||||
'Attachment of type "' . $q->escapeHTML($ctype)
|
||||
. '" ' . $dlink
|
||||
);
|
||||
} else {
|
||||
print $q->div(
|
||||
{-class => 'elidemsg'},
|
||||
'MIME part of type "' . $q->escapeHTML($ctype)
|
||||
. '" elided'
|
||||
);
|
||||
}
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
$part->isattachment
|
||||
and print AttachmentHeader($part->filename, $patchnum);
|
||||
|
||||
if ($part->isbinary) { # Implies isattachment
|
||||
print $q->escapeHTML($part->body);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: www/en/layout/css/query-pr.css,v 1.4 2007/06/04 04:39:51 chinsan Exp $
|
||||
* $FreeBSD: www/en/layout/css/query-pr.css,v 1.5 2011/07/20 22:23:23 shaun Exp $
|
||||
*/
|
||||
|
||||
.attachwin {
|
||||
|
@ -157,6 +157,13 @@ td {
|
|||
|
||||
.mimeboundary { border-top: 1px #DD0000 dashed; border-bottom: 0px; }
|
||||
|
||||
.elidemsg {
|
||||
padding: 4px;
|
||||
background-color: #C6C6C6;
|
||||
font-weight: bold;
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
|
||||
/* Footer */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue