Attachment Improvements By Xon

xF2 Add-on Attachment Improvements By Xon 2.6.5

No permission to download
  • Require XF2.1+, remove XF2.0 support
  • Fix "Call to a member function save() on null" when handing an invalid jpeg
  • Fix SVG thumbnail support for XF2.1 (for new attachments)
  • Fix "Error: Call to a member function save() on null" when handling Jpeg's without exif information
  • Fix compatibility issue with some 3rd party add-ons
  • Fix per-forum attachment permissions not applying
  • Correctly set "Allowed Image Attachment File Extensions" type as string not boolean
  • Add an icon
  • Better handle X-Accel-Redirect when no 'internalDataUrl' is configured
  • Initial XF2.1 compatibility update
Additional configuration is required to enable X-Accel-Redirect when using DigitalOcean Spaces or Amazon S3

A internalDataUrl stanza l must be added to config.php like the externalDataUrl described in the tutorial


Code:
PHP:
$config['internalDataUrl'] = function($externalPath, $canonical)
{
    return 'internal_data_s3/..../internal_data/' . $externalPath;
};

nginx config must be updated with a new internal_data_s3 block;

Code:
location ~* /internal_data_s3/(.*?)://(.*?)/(.*) {
    internal;
    set $xfEtag $upstream_http_etag;
    set $download_protocol $1;
    set $download_host $2;
    set $download_path $3;
    set $download_url $download_protocol://$download_host/$download_path;
 
    resolver 127.0.0.1 ipv6=off;
    proxy_set_header Host $download_host;
    proxy_set_header Authorization '';
    proxy_set_header Cookie '';
    proxy_max_temp_file_size 0;
    proxy_intercept_errors on;
    error_page 301 302 307 = @handle_redirect;
 
    proxy_pass $download_url$is_args$args;
 
    proxy_hide_header Content-Disposition;
    proxy_hide_header Content-Type;
    proxy_hide_header Etag;
    proxy_hide_header x-amz-request-id;
 
    add_header Etag $xfEtag;
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;
}

location @handle_redirect {
   resolver 127.0.0.1 ipv6=off;
   set $saved_redirect_location '$upstream_http_location';
   proxy_pass $saved_redirect_location;
}


  • Add missing option phrases for the image attachment extension list. option
  • Fix incorrectly using svg url for thumbnail
  • Repackage installer to ensure leftover development bits are fully removed
732Threads
2,290Messages
64,465Members
ActuallyWaitLatest member
Back