user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] msgiter: msg_part_text returns undef on text/html
@ 2019-12-18  9:14  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2019-12-18  9:14 UTC (permalink / raw)
  To: meta

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')
---
 lib/PublicInbox/MsgIter.pm | 5 +++++
 1 file changed, 5 insertions(+)

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 = $@;
 

^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-12-18  9:14  7% [PATCH] msgiter: msg_part_text returns undef on text/html Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).