Attachment Improvements By Xon

Attachment Improvements By Xon 2.6.7

No permission to download
  • ErrorException: [E_WARNING] fseek(): Stream does not support seeking
  • src/addons/SV/AttachmentImprovements/PartialResponseStream.php:66
  • Feb 18, 2025 at 8:29 AM
I am seeing this error pop up in the past week or so. Is this a PHP error? Runing 8.2
I also get the same error. I didn't think I was doing anything special with attachments, but perhaps we're both running Digital Points "App for CloduFlare" @Blackbeard ?
 
Here's my stack trace, pretty direct from the looks of it:

Code:
ErrorException: [E_WARNING] fseek(): Stream does not support seeking src/addons/SV/AttachmentImprovements/PartialResponseStream.php:66
Generated by: Unknown account Feb 21, 2025 at 6:22 PM
Stack trace
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] fse...', '/chroot/home/al...', 66)
#1 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(66): fseek(Resource id #60, 0)
#2 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(116): SV\AttachmentImprovements\PartialResponseStream->readChunks(true)
#3 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(52): SV\AttachmentImprovements\PartialResponseStream->getContents()
#4 src/XF/Http/Response.php(468): SV\AttachmentImprovements\PartialResponseStream->getLength()
#5 src/XF/Http/Response.php(293): XF\Http\Response->sendBody()
#6 src/XF.php(856): XF\Http\Response->send(Object(XF\Http\Request))
#7 index.php(23): XF::runApp('XF\\Pub\\App')
#8 {main}
 
Here's my stack trace, pretty direct from the looks of it:

Code:
ErrorException: [E_WARNING] fseek(): Stream does not support seeking src/addons/SV/AttachmentImprovements/PartialResponseStream.php:66
Generated by: Unknown account Feb 21, 2025 at 6:22 PM
Stack trace
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] fse...', '/chroot/home/al...', 66)
#1 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(66): fseek(Resource id #60, 0)
#2 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(116): SV\AttachmentImprovements\PartialResponseStream->readChunks(true)
#3 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(52): SV\AttachmentImprovements\PartialResponseStream->getContents()
#4 src/XF/Http/Response.php(468): SV\AttachmentImprovements\PartialResponseStream->getLength()
#5 src/XF/Http/Response.php(293): XF\Http\Response->sendBody()
#6 src/XF.php(856): XF\Http\Response->send(Object(XF\Http\Request))
#7 index.php(23): XF::runApp('XF\\Pub\\App')
#8 {main}
I'll need to contact @digitalpoint to workout compatibility for this
 
Hello, I am on Xenforo 2.3 and can't seem to get the X-Accel-Redirect functionality to work (at least the permission/validation feature).

The internal_data/ folder is available directly in web root, and I have added

Code:
location ^~ /internal_data/ {
        internal;
        add_header Etag $upstream_http_etag;
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;
}

To my existing nginx configuration which has working friendly urls.

The issue is the addon doesn't seem to do anything for video attachments as even after installing and enabling the Nginx X-Accel-Redirect addon option, videos are still uploaded to the /data directory, resulting in urls such as domain.com/data/video/0/filename.mp4.

Do I have to add something to the config to make video attachments get uploaded to the internal_data/ directory, but not thumbnails and avatars and such? Or am I missing something completely?
 
The videos are exposed as a direct URL, so the x-accel-redirect feature isn't actually required as php isn't in the path when the video is loaded
 
@Xon , can this addon limit the attachments to the thread starter only for each node? I don't want posts after the first to be able to attach anything. Thanks!
 
That isn't supported, but adding an option or permission for that wouldn't be hard if you would like to commission that work
 
The videos are exposed as a direct URL, so the x-accel-redirect feature isn't actually required as php isn't in the path when the video is loaded
"This permits XenForo to-do validation and authentication, and offload the actual file serving to Nginx."

Am I confused or does this not mean that video attachments uploaded should no longer be accessible via a public link, or if it is, only accessible if you are logged in? Exactly how image attachments currently behave.

After installing this addon, changing the nginx configuration as told, and enabling the addon and the x-accel-redirect feature, there is zero change in how video attachments are uploaded or played/served from before.
 
Last edited:
Bug report:

With this enabled on my 2.2 install, I can no longer add/update icons for Resource Manager resources.

It seems to be this function getAbstractedIconPath that is removing the .jpg extension erroneously. In debug, icon_ext is equal to "" not null.

Code:
ErrorException: [E_WARNING] fopen(W:\XXXXX\wwwroot\data\resource_icons/0/415.): Failed to open stream: Permission denied in src\vendor\league\flysystem\src\Adapter\Local.php at line 157
XF::handlePhpError()
fopen() in src\vendor\league\flysystem\src\Adapter\Local.php at line 157
League\Flysystem\Adapter\Local->writeStream() in src\vendor\league\flysystem\src\Filesystem.php at line 122
League\Flysystem\Filesystem->putStream() in src\vendor\league\flysystem-eventable-filesystem\src\EventableFilesystem.php at line 430
League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod() in src\vendor\league\flysystem-eventable-filesystem\src\EventableFilesystem.php at line 395
League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall() in src\vendor\league\flysystem-eventable-filesystem\src\EventableFilesystem.php at line 71
League\Flysystem\EventableFilesystem\EventableFilesystem->putStream() in src\vendor\league\flysystem\src\MountManager.php at line 615
League\Flysystem\MountManager->putStream() in src\XF\Util\File.php at line 208
XF\Util\File::copyFileToAbstractedPath() in src\addons\XFRM\Service\ResourceItem\Icon.php at line 159
XFRM\Service\ResourceItem\Icon->updateIcon() in src\addons\SV\AttachmentImprovements\XFRM\Service\ResourceItem\Icon.php at line 76
SV\AttachmentImprovements\XFRM\Service\ResourceItem\Icon->updateIcon() in src\addons\XFRM\ControllerPlugin\ResourceIcon.php at line 31
XFRM\ControllerPlugin\ResourceIcon->actionUpload() in src\addons\XFRM\Pub\Controller\ResourceItem.php at line 1214
XFRM\Pub\Controller\ResourceItem->actionEditIcon() in src\XF\Mvc\Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 259
XF\Mvc\Dispatcher->dispatchFromMatch() in src\XF\Mvc\Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src\XF\App.php at line 2487
XF\App->run() in src\XF.php at line 524
XF::runApp() in index.php at line 20

Disabling this addon and everything works fine.
 
Hi, I'm using Cloudflare R2 for files storage. The SVG/JPG work for both thumbnails and Full images upload and showing.

But after I've enabled the Nginx X-Accel-Redirect Support option, I can no longer insert svg/jpg as Full images, only ok as thumbnails. An empty space will appear if I click insert as full image.

When I click on the thumbnails in posts, file not found appears instead of a full image in lightbox.

Code:
        location /src/ {
        internal;
        }

        location ^~ /internal_data {
        internal;
        add_header Etag $upstream_http_etag;
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;
        }

        # SVG Template by Xon
        location ^~ /data/svg/ {
        access_log off;
        rewrite ^/data/svg/([^/]+)/([^/]+)/([^/]+)/([^\.]+).svg$ /svg.php?svg=$4&s=$1&l=$2&d=$3$args last;
        return 403;
        }

What else should I add in mysite.conf or src/config.php ? Thanks.
 
The X-Accel-Redirect option is unlikely to work with Cloudflare R2, as it is about redirecting nginx to load the files locally. Making cloudflare do a remote redirect is much more complicated, and outside the support I offer for my free add-ons
 
Back
Top Bottom