about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-25 21:29:43 +0000
committerEric Wong <e@80x24.org>2016-06-25 21:29:43 +0000
commit073efc43a68cbd6852939ccaf644dbb380cdc143 (patch)
treeba2a9a30438dec53aaa435443a6dd9adfee30dfc /lib
parent13eda978e8937065575623d045f78592cbb6d022 (diff)
downloadpublic-inbox-073efc43a68cbd6852939ccaf644dbb380cdc143.tar.gz
Angle brackets around the --in-reply-to= arg for git send-email
has been optional since git v1.5.3.2, so strip them and make the
command-line argument easier-to-type.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/View.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 30d8e3e8..38e35bf3 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -455,6 +455,15 @@ sub _parent_headers {
         $rv;
 }
 
+sub squote_maybe ($) {
+        my ($val) = @_;
+        if ($val =~ m{([^\w@\./,\%\+\-])}) {
+                $val =~ s/(['!])/'\\$1'/g; # '!' for csh
+                return "'$val'";
+        }
+        $val;
+}
+
 sub mailto_arg_link {
         my ($hdr) = @_;
         my %cc; # everyone else
@@ -475,7 +484,7 @@ sub mailto_arg_link {
         my $subj = $hdr->header('Subject') || '';
         $subj = "Re: $subj" unless $subj =~ /\bRe:/i;
         my $mid = $hdr->header_raw('Message-ID');
-        push @arg, "--in-reply-to='" . ascii_html($mid) . "'";
+        push @arg, '--in-reply-to='.ascii_html(squote_maybe(mid_clean($mid)));
         my $irt = uri_escape_utf8($mid);
         delete $cc{$to};
         push @arg, '--to=' . ascii_html($to);