[Rt-commit] rt branch, 4.4/external-link, created. rt-4.4.1-98-gbee6259

Alex Vandiver alexmv at bestpractical.com
Sat Aug 6 02:12:32 EDT 2016


The branch, 4.4/external-link has been created
        at  bee6259f3b2de401709237c574885b95442d74c7 (commit)

- Log -----------------------------------------------------------------
commit bee6259f3b2de401709237c574885b95442d74c7
Author: Alex Vandiver <alex at chmrr.net>
Date:   Sat Jun 18 01:11:51 2016 -0400

    Only generate the external link if the attachment is external
    
    Though the documentation for the method notes that it may return undef
    if the object is not in external storage, the code does not follow
    this.  In an RT which is configured for external storage, attachments
    may not be external yet if they do not meet the ShouldStoreExternally
    criteria, or if the rt-externalize-attachments cron job has not yet
    moved them.
    
    In the case of Amazon, the one storage engine capable of direct
    linking, assuming they are external causes the entire contents of the
    attachment to be returned as the "URL," which is inlined into the
    page with unfortunate results.
    
    Only ask the engine for its external storage link if it is, in fact,
    stored externally.

diff --git a/lib/RT/System.pm b/lib/RT/System.pm
index a246cb1..f5c2d39 100644
--- a/lib/RT/System.pm
+++ b/lib/RT/System.pm
@@ -386,6 +386,8 @@ sub ExternalStorageURLFor {
     # external storage direct links disabled
     return undef if !RT->Config->Get('ExternalStorageDirectLink');
 
+    return undef unless $Object->ContentEncoding eq 'external';
+
     return $self->ExternalStorage->DownloadURLFor($Object);
 }
 

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


More information about the rt-commit mailing list