about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-01 10:06:45 +0000
committerEric Wong <e@yhbt.net>2020-06-03 04:04:21 +0000
commit30ac717281ae224a9c117361ca941818adc69cf3 (patch)
treea9af6d0092c7fea1ba7b55951e6fe82e853b1732
parent01574fe596bceae54f8ead45991b9ac4fe35ea10 (diff)
downloadpublic-inbox-30ac717281ae224a9c117361ca941818adc69cf3.tar.gz
The goal of this is to eventually remove the $smsg->{mime} field
which is easy-to-misuse and cause memory explosions which
necessitated fixes like commit 7d02b9e64455831d
("view: stop storing all MIME objects on large threads").
-rw-r--r--lib/PublicInbox/Inbox.pm6
-rw-r--r--lib/PublicInbox/SolverGit.pm4
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index c295b267..bd1489e3 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -334,6 +334,12 @@ sub smsg_mime {
         }
 }
 
+sub smsg_eml {
+        my ($self, $smsg) = @_;
+        my $bref = msg_by_smsg($self, $smsg) or return;
+        PublicInbox::Eml->new($bref);
+}
+
 sub mid2num($$) {
         my ($self, $mid) = @_;
         my $mm = mm($self) or return;
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index f718e28c..b1cb1ae9 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -233,8 +233,8 @@ sub find_extract_diffs ($$$) {
 
         my $diffs = [];
         foreach my $smsg (@$msgs) {
-                $ibx->smsg_mime($smsg) or next;
-                delete($smsg->{mime})->each_part(\&extract_diff,
+                my $eml = $ibx->smsg_eml($smsg) or next;
+                $eml->each_part(\&extract_diff,
                                 [$self, $diffs, $pre, $post, $ibx, $smsg], 1);
         }
         @$diffs ? $diffs : undef;