X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=script%2Fpublic-inbox-edit;h=240beb3a168ff3e6c6a35e4814b3cab144761642;hb=29c5f2a6fc3b86306a5dbeadfae061d06f2bc6dd;hp=d8e511b2ee457da4c0d7f59449376b94bd345751;hpb=098fecd1fe516a00fbfd49622b82be382ebcdab6;p=public-inbox.git diff --git a/script/public-inbox-edit b/script/public-inbox-edit index d8e511b2..240beb3a 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -13,7 +13,7 @@ use PublicInbox::ContentHash qw(content_hash); use PublicInbox::MID qw(mid_clean mids); PublicInbox::Admin::check_require('-index'); use PublicInbox::Eml; -use PublicInbox::InboxWritable; +use PublicInbox::InboxWritable qw(eml_from_path); use PublicInbox::Import; my $usage = "$0 -m MESSAGE_ID [--all] [INBOX_DIRS]"; @@ -92,11 +92,10 @@ Multiple messages with different content found matching warn "Will edit all of them\n"; } } else { - my $mime = PublicInbox::InboxWritable::mime_from_path($file) or - die "open($file) failed: $!"; - my $mids = mids($mime->header_obj); + my $eml = eml_from_path($file) or die "open($file) failed: $!"; + my $mids = mids($eml); find_mid($found, $_, \@ibxs) for (@$mids); # populates $found - my $chash = content_hash($mime); + my $chash = content_hash($eml); my $to_edit = $found->{$chash}; unless ($to_edit) { my $nr = scalar(keys %$found); @@ -215,9 +214,9 @@ W: possible message boundary splitting error # allow changing Received: and maybe other headers which can # contain sensitive info. - my $nhdr = $new_mime->header_obj; - my $ohdr = $old_mime->header_obj; - if (($nhdr->as_string eq $ohdr->as_string) && + my $nhdr = $new_mime->header_obj->as_string; + my $ohdr = $old_mime->header_obj->as_string; + if (($nhdr eq $ohdr) && (content_hash($new_mime) eq content_hash($old_mime))) { warn "No change detected to:\n", show_cmd($ibx, $smsg);