View | Details | Raw Unified | Return to bug 132344
Collapse All | Expand All

(-)query-pr.cgi (-2 / +17 lines)
Lines 610-616 Link Here
610
								if ($patchname =~ /$binary_filetypes/) {
610
								if ($patchname =~ /$binary_filetypes/) {
611
									$outp = "(Binary attachment not viewable.)\n";
611
									$outp = "(Binary attachment not viewable.)\n";
612
								} else {
612
								} else {
613
									$outp =~ s/^X-Attachment-Id: \x0a?//i;
614
									$outp =~ s/^f_.{7}[a-z]?[0-9]*//i;
615
									$outp =~ s/^file[0-9]*//i;
613
									$outp = decode_base64($outp);
616
									$outp = decode_base64($outp);
617
									if ($outp =~ /[[:^ascii:]]/) { 
618
											$outp = "(Unable to decode attachment using base64.)\n";
619
									}
614
								}
620
								}
615
621
616
								$outp = "--- $patchname begins here ---\n"
622
								$outp = "--- $patchname begins here ---\n"
Lines 638-644 Link Here
638
							}
644
							}
639
							next;
645
							next;
640
						} else {
646
						} else {
641
							$mime_endheader = 1;
647
							# XXX: Commented out to fix an issue if transfer-encoding is not the 
648
							#	   last header before base64 payload really starts.
649
							#$mime_endheader = 1;
642
							if ($mime_headers{'transfer-encoding'}) {
650
							if ($mime_headers{'transfer-encoding'}) {
643
								my $enc = $mime_headers{'transfer-encoding'};
651
								my $enc = $mime_headers{'transfer-encoding'};
644
								if ($enc =~ /^\s*["']?base64["']?\s*$/i) {
652
								if ($enc =~ /^\s*["']?base64["']?\s*$/i) {
Lines 1004-1010 Link Here
1004
		$inpatch = 0;
1012
		$inpatch = 0;
1005
		$mime_boundary = undef;
1013
		$mime_boundary = undef;
1006
		if ($outp ne "") {
1014
		if ($outp ne "") {
1007
			print decode_base64($outp);
1015
			$outp =~ s/^X-Attachment-Id: \x0a?//i;
1016
			$outp =~ s/^f_.{7}[a-z]?[0-9]*//i;
1017
			$outp =~ s/^file[0-9]*//i;
1018
			my $decoded_file = decode_base64($outp);
1019
			if ($decoded_file =~ /[[:^ascii:]]/) { 
1020
				$decoded_file = $outp;
1021
			}
1022
			print ($decoded_file);
1008
			$outp = "";
1023
			$outp = "";
1009
		}
1024
		}
1010
		return -1;
1025
		return -1;

Return to bug 132344