[Rt-commit] rt branch, 4.4/external-storage, updated. rt-4.2.11-69-g473b1d1

Shawn Moore shawn at bestpractical.com
Wed May 27 13:07:16 EDT 2015


The branch, 4.4/external-storage has been updated
       via  473b1d11acd11510380627bff922d29b7cd636fb (commit)
       via  2d814a26e5ef6bbf54bfb29e85fc7f2b780c5b7f (commit)
       via  1a90b2c18b403b0961de961d8c0294f43032ef99 (commit)
       via  4fbcb972cf640679c02c2bae5b434ec798e0e67c (commit)
       via  f8bad3ff15a5f7ae627b017a2c7c95e1184e57fd (commit)
       via  e2c2f857bafa9825cd5aceba43ce3d609da50e92 (commit)
      from  ba31033dd021f6541d5012188fb1dbdf41dfe438 (commit)

Summary of changes:
 etc/RT_Config.pm.in               | 13 ++++++----
 lib/RT/ExternalStorage/Dropbox.pm | 13 ++++------
 lib/RT/Record.pm                  | 50 +++++++++++++++++++++------------------
 3 files changed, 39 insertions(+), 37 deletions(-)

- Log -----------------------------------------------------------------
commit e2c2f857bafa9825cd5aceba43ce3d609da50e92
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed May 27 16:37:06 2015 +0000

    Point users to ExternalStorage::Dropbox doc when no access token
    
        Better for them to get the full walkthrough than to get the truncated
        version we can give them in an error message

diff --git a/lib/RT/ExternalStorage/Dropbox.pm b/lib/RT/ExternalStorage/Dropbox.pm
index 6291234..6398e37 100644
--- a/lib/RT/ExternalStorage/Dropbox.pm
+++ b/lib/RT/ExternalStorage/Dropbox.pm
@@ -69,8 +69,7 @@ sub Init {
         RT->Logger->error("Required module File::Dropbox is not installed");
         return;
     } elsif (not $self->{AccessToken}) {
-        RT->Logger->error("AccessToken not provided for Dropbox.  Register a new application"
-                      . " at https://www.dropbox.com/developers/apps and generate an access token.");
+        RT->Logger->error("AccessToken not provided for Dropbox. See the documentation for " . __PACKAGE__ . " for setting up this integration.");
         return;
     }
 

commit f8bad3ff15a5f7ae627b017a2c7c95e1184e57fd
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed May 27 16:47:12 2015 +0000

    Dropbox has deprecated the datastore API
    
        So its app creation wizard doesn't ask that any more

diff --git a/lib/RT/ExternalStorage/Dropbox.pm b/lib/RT/ExternalStorage/Dropbox.pm
index 6398e37..0841d8b 100644
--- a/lib/RT/ExternalStorage/Dropbox.pm
+++ b/lib/RT/ExternalStorage/Dropbox.pm
@@ -166,21 +166,17 @@ Choose B<Dropbox API app> as the type of app.
 
 =item 4.
 
-Choose the B<Files and datastores> as the type of data to store.
-
-=item 5.
-
 Choose B<Yes>, your application only needs access to files it creates.
 
-=item 6.
+=item 5.
 
 Enter a descriptive name -- C<Request Tracker files> is fine.
 
-=item 7.
+=item 6.
 
 Under C<Generated access token>, click the C<Generate> button.
 
-=item 8.
+=item 7.
 
 Copy the provided value into your F<RT_SiteConfig.pm> file as the
 C<AccessToken>:

commit 4fbcb972cf640679c02c2bae5b434ec798e0e67c
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed May 27 16:56:26 2015 +0000

    Explain that S3 is the only engine that can do direct links
    
        Dropbox does have a way to generate sharing hyperlinks, but it's not
        supported in the module we use (unfortunately, File::Dropbox::metadata
        doesn't include the link).

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 5ab68b6..2076000 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2576,11 +2576,14 @@ Set($ExternalStorageCutoffSize, 10*1024*1024);
 
 =item C<$ExternalStorageDirectLink>
 
-Certain ExternalStorage backends can serve files over HTTP (such as
-L<RT::ExternalStorage::AmazonS3>). For such backends, RT will link
-directly to those files in external storage. This cuts down download
-time and relieves resource pressure because RT's web server is no longer
-involved in retrieving and then immediately serving each attachment.
+Certain ExternalStorage backends can serve files over HTTP.  For such
+backends, RT will link directly to those files in external storage. This
+cuts down download time and relieves resource pressure because RT's web
+server is no longer involved in retrieving and then immediately serving
+each attachment.
+
+Of the storage engines that RT ships, only
+L<RT::ExternalStorage::AmazonS3> supports this feature.
 
 If you prefer to have RT serve these files (perhaps to maintain an access
 log), you can set this option to false.

commit 1a90b2c18b403b0961de961d8c0294f43032ef99
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed May 27 17:02:11 2015 +0000

    Improve _DecodeLOB's doc and mention external storage

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 88800ef..2407a46 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -860,24 +860,28 @@ sub _EncodeLOB {
 Unpacks data stored in the database, which may be base64 or QP encoded
 because of our need to store binary and badly encoded data in columns
 marked as UTF-8.  Databases such as PostgreSQL and Oracle care that you
-are feeding them invalid UTF-8 and will refuse the content.  This
-function handles unpacking the encoded data.
+are feeding them invalid UTF-8 and will refuse the content.  This function
+handles unpacking the encoded data.
 
-It returns textual data as a UTF-8 string which has been processed by Encode's
-PERLQQ filter which will replace the invalid bytes with \x{HH} so you can see
-the invalid byte but won't run into problems treating the data as UTF-8 later.
+Alternatively, if the data lives in external storage, it will be read
+(or downloaded) and returned.
+
+C<_DecodeLOB> returns textual data as a UTF-8 string which has been
+processed by L<Encode>'s PERLQQ filter which will replace the invalid bytes
+with C<\x{HH}> so you can see the invalid byte but won't run into problems
+treating the data as UTF-8 later.
 
 This is similar to how we filter all data coming in via the web UI in
-RT::Interface::Web::DecodeARGS. This filter should only end up being
+L<RT::Interface::Web/DecodeARGS>. This filter should only end up being
 applied to old data from less UTF-8-safe versions of RT.
 
 If the passed C<ContentType> includes a character set, that will be used
 to decode textual data; the default character set is UTF-8.  This is
 necessary because while we attempt to store textual data as UTF-8, the
 definition of "textual" has migrated over time, and thus we may now need
-to attempt to decode data that was previously not trancoded on insertion.
+to attempt to decode data that was previously not transcoded on insertion.
 
-Important Note - This function expects an octet string and returns a
+Important note: This function expects an octet string and returns a
 character string for non-binary data.
 
 =cut

commit 2d814a26e5ef6bbf54bfb29e85fc7f2b780c5b7f
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed May 27 17:02:39 2015 +0000

    Make encoding=external a sibling branch
    
        alexmv++
    
        https://github.com/bestpractical/rt/commit/4cfc6b50c49d7168f06df89b3cf3356c86a888a3#commitcomment-11335777

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 2407a46..d64ce1e 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -892,7 +892,15 @@ sub _DecodeLOB {
     my $ContentEncoding = shift || 'none';
     my $Content         = shift;
 
-    if ($ContentEncoding eq 'external') {
+    RT::Util::assert_bytes( $Content );
+
+    if ( $ContentEncoding eq 'base64' ) {
+        $Content = MIME::Base64::decode_base64($Content);
+    }
+    elsif ( $ContentEncoding eq 'quoted-printable' ) {
+        $Content = MIME::QuotedPrint::decode($Content);
+    }
+    elsif ( $ContentEncoding eq 'external' ) {
         my $Storage = RT->System->ExternalStorage;
         unless ($Storage) {
             RT->Logger->error( "Failed to load $Content; external storage not configured" );
@@ -905,21 +913,12 @@ sub _DecodeLOB {
             return ("");
         }
 
-        $Content = $ok;
-        $ContentEncoding = 'none';
-    }
-
-    RT::Util::assert_bytes( $Content );
-
-    if ( $ContentEncoding eq 'base64' ) {
-        $Content = MIME::Base64::decode_base64($Content);
-    }
-    elsif ( $ContentEncoding eq 'quoted-printable' ) {
-        $Content = MIME::QuotedPrint::decode($Content);
+        return ($ok);
     }
     elsif ( $ContentEncoding && $ContentEncoding ne 'none' ) {
         return ( $self->loc( "Unknown ContentEncoding [_1]", $ContentEncoding ) );
     }
+
     if ( RT::I18N::IsTextualContentType($ContentType) ) {
         my $entity = MIME::Entity->new();
         $entity->head->add("Content-Type", $ContentType);

commit 473b1d11acd11510380627bff922d29b7cd636fb
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed May 27 17:05:45 2015 +0000

    Improve the use of variables in _DecodeLOB/external
    
        Move the digest from $Content into $Digest and make $Content hold
        the content :)

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index d64ce1e..69d06d6 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -901,19 +901,20 @@ sub _DecodeLOB {
         $Content = MIME::QuotedPrint::decode($Content);
     }
     elsif ( $ContentEncoding eq 'external' ) {
+        my $Digest = $Content;
         my $Storage = RT->System->ExternalStorage;
         unless ($Storage) {
             RT->Logger->error( "Failed to load $Content; external storage not configured" );
             return ("");
         };
 
-        my ($ok, $msg) = $Storage->Get( $Content );
-        unless (defined $ok) {
-            RT->Logger->error( "Failed to load $Content from external storage: $msg" );
+        ($Content, my $msg) = $Storage->Get( $Digest );
+        unless (defined $Content) {
+            RT->Logger->error( "Failed to load $Digest from external storage: $msg" );
             return ("");
         }
 
-        return ($ok);
+        return ($Content);
     }
     elsif ( $ContentEncoding && $ContentEncoding ne 'none' ) {
         return ( $self->loc( "Unknown ContentEncoding [_1]", $ContentEncoding ) );

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


More information about the rt-commit mailing list