[Rt-commit] rt branch, 4.2/pass-octets-to-encodelob, created. rt-4.2.1-54-g74683a7

Kevin Falcone falcone at bestpractical.com
Mon Dec 16 17:31:05 EST 2013


The branch, 4.2/pass-octets-to-encodelob has been created
        at  74683a70ff54c142dfdd64bdbf305346b73cda81 (commit)

- Log -----------------------------------------------------------------
commit 74683a70ff54c142dfdd64bdbf305346b73cda81
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Dec 16 16:28:14 2013 -0500

    _EncodeLOB expects to get an octet string.
    
    We were passing the character string returned from _DecodeLOB and
    persisted by Storable.  This caused checks of validity to fail and
    things that should have been encoded in Quoted-Printable to instead end
    up being passed directly to PostgreSQL which kicks them back as invalid
    UTF-8.
    
    Combined with our change to _DecodeLOB to now strictly decode to UTF-8
    and apply Encode::PerlQQ, we should no longer be able to pass invalid
    data along to the database.  The Encode::FB_Croak enforces this before
    we get to the DB.

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index d113c57..8a422bc 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -2423,7 +2423,7 @@ sub PreInflate {
         my ($content_col) = grep {exists $ca{$_}} qw/LargeContent Content/;
         if (defined $data->{$content_col}) {
             my ($ContentEncoding, $Content) = $class->_EncodeLOB(
-                $data->{$content_col},
+                Encode::encode("UTF-8",$data->{$content_col},Encode::FB_CROAK),
                 $data->{ContentType},
             );
             $data->{ContentEncoding} = $ContentEncoding;

-----------------------------------------------------------------------


More information about the rt-commit mailing list