about summary refs log tree commit homepage
path: root/script/public-inbox-edit
diff options
context:
space:
mode:
Diffstat (limited to 'script/public-inbox-edit')
-rwxr-xr-xscript/public-inbox-edit8
1 files changed, 3 insertions, 5 deletions
diff --git a/script/public-inbox-edit b/script/public-inbox-edit
index 1fbaf5a7..88115d7c 100755
--- a/script/public-inbox-edit
+++ b/script/public-inbox-edit
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Used for editing messages in a public-inbox.
@@ -184,12 +184,10 @@ retry_edit:
         # rename/relink $edit_fn
         open my $new_fh, '<', $edit_fn or
                 die "can't read edited file ($edit_fn): $!\n";
-        defined(my $new_raw = do { local $/; <$new_fh> }) or die
-                "read $edit_fn: $!\n";
+        my $new_raw = PublicInbox::IO::read_all $new_fh;
 
         if (!$opt->{raw}) {
-                # get rid of the From we added
-                $new_raw =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
+                PublicInbox::Eml::strip_from($new_raw);
 
                 # check if user forgot to purge (in mutt) after editing
                 if ($new_raw =~ /^From /sm) {