X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=script%2Fpublic-inbox-edit;h=f2090abfe583992ab6c398213438c3a76a3775d3;hb=4821798351defce82c102e46d6f5f84f0cdc0e34;hp=7a534cc2b094bc5f796a34aec32ce76dbda0a48a;hpb=6e507c8cb41b0d48963503a88034348d74506211;p=public-inbox.git diff --git a/script/public-inbox-edit b/script/public-inbox-edit index 7a534cc2..f2090abf 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -14,6 +14,7 @@ use PublicInbox::MID qw(mid_clean mids); PublicInbox::Admin::check_require('-index'); require PublicInbox::MIME; require PublicInbox::InboxWritable; +require PublicInbox::Import; my $usage = "$0 -m MESSAGE_ID [--all] [INBOX_DIRS]"; my $opt = { verbose => 1, all => 0, -min_inbox_version => 2, raw => 0 }; @@ -64,7 +65,7 @@ sub find_mid ($) { sub show_cmd ($$) { my ($ibx, $smsg) = @_; - " GIT_DIR=$ibx->{mainrepo}/all.git \\\n git show $smsg->{blob}\n"; + " GIT_DIR=$ibx->{inboxdir}/all.git \\\n git show $smsg->{blob}\n"; } sub show_found () { @@ -120,7 +121,7 @@ $mids my $tmpl = 'public-inbox-edit-XXXXXX'; foreach my $to_edit (values %$found) { - my ($edit_fh, $edit_fn) = tempfile($tmpl, TMPDIR => 1); + my ($edit_fh, $edit_fn) = tempfile($tmpl, TMPDIR => 1, UNLINK => 1); $edit_fh->autoflush(1); my ($ibx, $smsg) = @{$to_edit->[0]}; my $old_raw = $ibx->msg_by_smsg($smsg); @@ -137,7 +138,7 @@ foreach my $to_edit (values %$found) { # run the editor, respecting spaces/quote retry_edit: - if (system(qw(sh -c), qq(eval "$editor" '"\$@"'), '--', $edit_fn)) { + if (system(qw(sh -c), $editor.' "$@"', $editor, $edit_fn)) { if (!(-t STDIN) && !$opt->{force}) { die "E: $editor failed: $?\n"; } @@ -197,6 +198,11 @@ W: possible message boundary splitting error my $new_mime = PublicInbox::MIME->new(\$new_raw); my $old_mime = PublicInbox::MIME->new($old_raw); + # make sure we don't compare unwanted headers, since mutt adds + # Content-Length, Status, and Lines headers: + PublicInbox::Import::drop_unwanted_headers($new_mime); + PublicInbox::Import::drop_unwanted_headers($old_mime); + # allow changing Received: and maybe other headers which can # contain sensitive info. my $nhdr = $new_mime->header_obj;