Attachment Improvements By Xon

Attachment Improvements By Xon 2.2.0

No permission to download
  • Fix XFMG support (ie content stored in data rather than internal_data)
  • Support for video stream via partial content requests
  • Add "Partial content maximum chunk size" option
  • Like
Reactions: eva2000 and vwts
  • 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)
  • Like
Reactions: vwts
  • 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
  • Like
Reactions: Claverhouse
  • Initial XF2.1 compatibility update
Using DigitalOcean Spaces or Amazon S3 for file storage in XF 2.x.

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

$config['internalDataUrl'] = function($externalPath, $canonical)
    return 'internal_data_s3/..../internal_data/' . $externalPath;
nginx config must be updated with a new internal_data_s3 block;
location ~* /internal_data_s3/(.*?)://(.*?)/(.*) { 
    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 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 ipv6=off;
   set $saved_redirect_location '$upstream_http_location';
   proxy_pass $saved_redirect_location;
To implement proxy caching see
  • Like
Reactions: MattW and Chris D
  • Add missing option phrases for the image attachment extension list. option
  • Fix incorrectly using svg url for thumbnail
  • Like
Reactions: MattW