diff options
author | lpsolit%gmail.com <> | 2008-06-30 00:35:28 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2008-06-30 00:35:28 +0200 |
commit | ba0b55cebea4cf2dd2085547e38e8f540f10c03b (patch) | |
tree | c02451dfdbc5de84eca2b1ba70733e3c0b3675ba /Bugzilla/Attachment | |
parent | 66146a6e56c9a23cad32a6cbf897018372c07e80 (diff) | |
download | bugzilla-ba0b55cebea4cf2dd2085547e38e8f540f10c03b.tar.gz bugzilla-ba0b55cebea4cf2dd2085547e38e8f540f10c03b.tar.xz |
Bug 441921: context=file fails due to taint issues in file names and file rev numbers - Patch by Frédéric Buclin <LpSolit@gmail.com> r=himorin a=LpSolit
Diffstat (limited to 'Bugzilla/Attachment')
-rw-r--r-- | Bugzilla/Attachment/PatchReader.pm | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Bugzilla/Attachment/PatchReader.pm b/Bugzilla/Attachment/PatchReader.pm index 44193ed86..cfc7610f4 100644 --- a/Bugzilla/Attachment/PatchReader.pm +++ b/Bugzilla/Attachment/PatchReader.pm @@ -23,8 +23,6 @@ use Bugzilla::Error; use Bugzilla::Attachment; use Bugzilla::Util; -use Encode; - sub process_diff { my ($attachment, $format, $context) = @_; my $dbh = Bugzilla->dbh; @@ -78,9 +76,9 @@ sub process_diff { setup_template_patch_reader($last_reader, $format, $context, $vars); # The patch is going to be displayed in a HTML page and if the utf8 # param is enabled, we have to encode attachment data as utf8. - # Encode::decode() knows what to do with invalid characters. if (Bugzilla->params->{'utf8'}) { - $attachment->{data} = Encode::decode_utf8($attachment->data); + $attachment->data; # Populate ->{data} + utf8::decode($attachment->{data}); } $reader->iterate_string('Attachment ' . $attachment->id, $attachment->data); } @@ -94,10 +92,11 @@ sub process_interdiff { # Encode attachment data as utf8 if it's going to be displayed in a HTML # page using the UTF-8 encoding. - # Encode::decode() knows what to do with invalid characters. if ($format ne 'raw' && Bugzilla->params->{'utf8'}) { - $old_attachment->{data} = Encode::decode_utf8($old_attachment->data); - $new_attachment->{data} = Encode::decode_utf8($new_attachment->data); + $old_attachment->data; # Populate ->{data} + utf8::decode($old_attachment->{data}); + $new_attachment->data; # Populate ->{data} + utf8::decode($new_attachment->{data}); } # Get old patch data. |