]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/process
Fix default user for usertags
[debbugs.git] / scripts / process
index b40360323cd77f8e805013ec9180ff59406811c7..d98cafa8a59f80982907ca9b79986880f6b02db9 100755 (executable)
@@ -183,7 +183,7 @@ for my $hdr (@headerlines) {
                         mail-followup-to|
                         references):
                 |From\s|X-Debbugs-)/xi;
                         mail-followup-to|
                         references):
                 |From\s|X-Debbugs-)/xi;
-    $fwd .= encode_utf8($hdr)."\n" if $ins;
+    $fwd .= $orig_hdr."\n" if $ins;
     # print {$debugfh} ">$_<\n";
     if (s/^(\S+):\s*//) {
        my $v = lc $1;
     # print {$debugfh} ">$_<\n";
     if (s/^(\S+):\s*//) {
        my $v = lc $1;
@@ -191,7 +191,13 @@ for my $hdr (@headerlines) {
            push @common_headers, 'X-Loop',$_;
        }
        print {$debugfh} ">$v=$_<\n";
            push @common_headers, 'X-Loop',$_;
        }
        print {$debugfh} ">$v=$_<\n";
-       $header{$v} = $_;
+       # Handle a comma which is escaped being passed through un-escaped. See
+       # https://bugs.debian.org/1041638
+       if ($_ =~ m/,/ and not $orig_hdr =~ m/,/) {
+           $header{$v} = handle_escaped_commas($_,$orig_hdr);
+       } else {
+           $header{$v} = $_;
+       }
     } else {
        print {$debugfh} "!>$_<\n";
     }
     } else {
        print {$debugfh} "!>$_<\n";
     }
@@ -216,7 +222,7 @@ if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) {
     map { s/^- // } @bodylines;
 }
 
     map { s/^- // } @bodylines;
 }
 
-#psuedoheaders
+#pseudoheaders
 my %pheader;
 my @control_bits;
 my @usertag_bits;
 my %pheader;
 my @control_bits;
 my @usertag_bits;
@@ -227,7 +233,7 @@ for my $phline (@bodylines)
     # Fixes #488554
     $phline =~ s/\xef\xbb\xbf//g;
     $phline =~ s/\N{U+FEFF}//g;
     # Fixes #488554
     $phline =~ s/\xef\xbb\xbf//g;
     $phline =~ s/\N{U+FEFF}//g;
-    last if $phline !~ m/^([\w-]+): # psuedoheader
+    last if $phline !~ m/^([\w-]+): # pseudoheader
                         (?:\s|\N{U+00A0})* # zero or more spaces, including
                                             # non-breaking space
                         (\S.*)/x; # pseudoheader value
                         (?:\s|\N{U+00A0})* # zero or more spaces, including
                                             # non-breaking space
                         (\S.*)/x; # pseudoheader value
@@ -699,7 +705,8 @@ if ($ref<0) { # new bug report
     $data->{msgid} = $header{'message-id'};
     writebug($ref, $data);
     # Deal with usertags
     $data->{msgid} = $header{'message-id'};
     writebug($ref, $data);
     # Deal with usertags
-    my $current_user = $replyto;
+    my $current_user;
+    unshift @usertag_bits, ['user', $replyto];
     for my $field (@usertag_bits) {
         my ($name, $value) = @$field;
         if ($name eq 'user') {
     for my $field (@usertag_bits) {
         my ($name, $value) = @$field;
         if ($name eq 'user') {
@@ -716,7 +723,7 @@ if ($ref<0) { # new bug report
                                             );
             }
         }
                                             );
             }
         }
-        if ($name eq 'usertags'){
+        if ($name eq 'usertags' and defined $current_user){
             my %user_tags;
             read_usertags(\%user_tags, $current_user);
             $value =~ s/(?:^\s+|\s+$)//g;
             my %user_tags;
             read_usertags(\%user_tags, $current_user);
             $value =~ s/(?:^\s+|\s+$)//g;