From 0f6b0cac5bf10d036a84dbab732e8991edf56c34 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 18 Apr 2020 03:38:46 +0000 Subject: inboxwritable: mime_from_path: reuse in more places There's nothing Maildir-specific about the function, so `maildir_path_load' was a bad name. So give it a more appropriate name and use it in our tests. This save ourselves some code and inconsistency by reusing an existing internal library routine in more places. We can drop the "From_" line in some of our (formerly) mbox sample files. --- script/public-inbox-edit | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'script/public-inbox-edit') diff --git a/script/public-inbox-edit b/script/public-inbox-edit index ae5d8289..28b1b5e8 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -92,9 +92,8 @@ Multiple messages with different content found matching warn "Will edit all of them\n"; } } else { - open my $fh, '<', $file or die "open($file) failed: $!"; - my $orig = do { local $/; <$fh> }; - my $mime = PublicInbox::MIME->new(\$orig); + my $mime = PublicInbox::InboxWritable::mime_from_path($file) or + die "open($file) failed: $!"; my $mids = mids($mime->header_obj); find_mid($found, $_, \@ibxs) for (@$mids); # populates $found my $cid = content_id($mime); -- cgit v1.2.3-24-ge0c7