about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-18 09:14:43 +0000
committerEric Wong <e@80x24.org>2019-12-19 03:57:23 +0000
commit55b11c59936125aab26694e17631828c7ea9954e (patch)
tree322782ae55d86f8666855ccd1fd7d33b1afdc46d /lib
parent3f14ba1c9e8d6b90904474a73a1ff6070a5799c6 (diff)
downloadpublic-inbox-55b11c59936125aab26694e17631828c7ea9954e.tar.gz
We want HTML parts to be downloadable, but not displayed as
unreadable (but injection-safe) HTML source in our own web
and Atom interfaces.

This affects indexing, too, as HTML tags/comments won't be
indexed anymore, but existing indices are only cleaned after
--reindex.  HTML-only mail won't be indexed at all, but we won't
cross that bridge until somebody cares about that crap.   We'll
continue to actively discourage such waste of CPU cycles,
bandwidth, cache and storage.

Fixes: 7d82a8bc04ce2e68 (handle "multipart/mixed" messages which are not multipart')
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/MsgIter.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/PublicInbox/MsgIter.pm b/lib/PublicInbox/MsgIter.pm
index d9df32ab..6453d9f1 100644
--- a/lib/PublicInbox/MsgIter.pm
+++ b/lib/PublicInbox/MsgIter.pm
@@ -38,6 +38,11 @@ sub msg_iter ($$) {
 sub msg_part_text ($$) {
         my ($part, $ct) = @_;
 
+        # TODO: we may offer a separate sub for people who need to index
+        # HTML-only mail, but the majority of HTML mail is multipart/alternative
+        # with a text part which we don't have to waste cycles decoding
+        return if $ct =~ m!\btext/x?html\b!;
+
         my $s = eval { $part->body_str };
         my $err = $@;