[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#61342: (no subject)



tag 61342 patch
thanks

The attached patch fixed this particular issue.

See http://bugs.donarmstrong.com/cgi/bugreport.cgi?bug=20

Unfortunatly, because of the way that the log file is written, the
solution is moderately ugly... but it shouldn't cause much of a
problem unless someone decides to stick RFC1522 names everywhere.

This patch leaves the mime encodings in the header of the
message... I'm not sure if it's ideal to remove them as well
currently.


Don Armstrong

-- 
Q: What Can a Thoughtful Man Hope for Mankind on Earth, Given the
Experience of the Past Million Years?
A: Nothing.
 -- Bokonon _The Fourteenth Book of Bokonon_ (Vonnegut _Cats Cradle_)

http://www.donarmstrong.com              http://rzlab.ucr.edu
? patch_for_61342.diff
Index: bugreport.cgi
===================================================================
RCS file: /cvs/debbugs/source/cgi/bugreport.cgi,v
retrieving revision 1.65
diff -u -r1.65 bugreport.cgi
--- bugreport.cgi	1 Jun 2004 00:41:26 -0000	1.65
+++ bugreport.cgi	31 Dec 2004 12:33:00 -0000
@@ -181,7 +181,7 @@
 $indexentry .= htmlpackagelinks($status{package}, 0);
 
 $indexentry .= "Reported by: <a href=\"" . submitterurl($status{originator})
-              . "\">" . htmlsanit($status{originator}) . "</a>;\n";
+              . "\">" . htmlsanit(de_rfc1522($status{originator})) . "</a>;\n";
 
 $indexentry .= "Owned by: " . htmlsanit($status{owner}) . ";\n"
               if length $status{owner};
@@ -369,7 +369,9 @@
 		$normstate= 'go';
 		push @mail, $_;
 	} elsif ($normstate eq 'html') {
-		$this .= $_;
+	        # XXX This is broken. The BTS shouldn't be writing
+	        # HTML into the log... but it does.
+		$this .= de_rfc1522($_);
 	} elsif ($normstate eq 'go') {
 		s/^\030//;
 		if (!$suppressnext && !$found_msgid &&
@@ -409,7 +411,7 @@
 			$thisheader = "<h2>Message sent:</h2>\n";
 		} else {
 			s/\04/, /g; s/\n$//;
-			$thisheader = "<h2>Message sent to ".htmlsanit($_).":</h2>\n";
+			$thisheader = "<h2>Message sent to ".htmlsanit(de_rfc1522($_)).":</h2>\n";
 		}
 		$this = "";
 		$normstate= 'kill-body';
Index: common.pl
===================================================================
RCS file: /cvs/debbugs/source/cgi/common.pl,v
retrieving revision 1.108
diff -u -r1.108 common.pl
--- common.pl	28 Mar 2004 06:02:45 -0000	1.108
+++ common.pl	31 Dec 2004 12:33:01 -0000
@@ -12,6 +12,10 @@
 
 use Debbugs::Versions;
 
+# for de_rfc1522
+use MIME::WordDecoder;
+MIME::WordDecoder->default(new MIME::WordDecoder::ISO_8859 1);
+
 $MLDBM::RemoveTaint = 1;
 
 my $common_archive = 0;
@@ -420,6 +424,23 @@
     $in =~ s/([<>&"])/\&$saniarray{$1};/g;
     return $in;
 }
+
+=head2 de_rfc1522
+
+     de_rfc1522('=?iso-8859-1?Q?D=F6n_Armstr=F3ng?= <don@donarmstrong.com>')
+
+Turn RFC-1522 names into the ISO-8859-1 or UTF-8 equivalent. [#61342 et al]
+
+=cut
+
+sub de_rfc1522($){
+     my ($string) = @_;
+
+     # unmime calls the default MIME::WordDecoder; handler set up at
+     # initalization time.
+     return unmime($string);
+}
+
 
 sub maybelink {
     my $in = shift;

Reply to: