Attachment Improvements By Xon

Attachment Improvements By Xon 2.6.7

No permission to download
Hello,
My xenForo version is 2.2.16, I've upgraded to version 2.6.2 and it still reports this strange error, hopefully you can fix it:

Server error log
  • ErrorException: Template error: [E_USER_WARNING] Method canAddResource is not callable on the given object (SV\AttachmentImprovements\XF\Entity\User)
  • src/XF/Template/Templater.php:1190
  • Generated by: Unknown account
  • Jul 20, 2024 at 6:21 PM

Stack trace​

#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/website/tcmbe/...', 1190)
#1 src/XF/Template/Templater.php(1190): trigger_error('Method canAddRe...', 512)
#2 internal_data/code_cache/templates/l2/s5/public/forum_overview_wrapper.php(49): XF\Template\Templater->method(Object(SV\AttachmentImprovements\XF\Entity\User), 'canAddResource', Array)
#3 src/XF/Template/Templater.php(1655): XF\Template\Templater->{closure}(Object(XV\Template\Templater), Array, NULL)
#4 src/XF/Template/Templater.php(1052): XF\Template\Templater->renderTemplate('forum_overview_...', Array, false)
#5 src/XF/Template/Templater.php(1670): XF\Template\Templater->applyWrappedTemplate('








...')
#6 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('forum_list', Array)
#7 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#8 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:Forum\\Listin...', 'public:forum_li...', Array)
#9 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XV\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#10 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XV\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#12 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#13 src/XF.php(524): XF\App->run()
#14 index.php(20): XF::runApp('XF\\Pub\\App')
#15 {main}

Request state​

array(4) {
["url"] => string(1) "/"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
That is unrelated to attachment improvements, it is hard to tell without seeing your add-on list; but it is what is expecting canAddResource to exist when it doesn't.

You can try disabling this addon but it is likely another that is triggering it.
 
I added this svg icon to a resource icon today and got error. Can you please see if it's the issue with svg itself @Xon ?

  • Error: Call to a member function getType() on null
  • src/addons/XFRM/Service/ResourceItem/Icon.php:153
  • 10/17/24 at 5:54 PM

Stack trace​

#0 src/addons/SV/AttachmentImprovements/XFRM/Service/ResourceItem/Icon.php(51): XFRM\Service\ResourceItem\Icon->updateIcon()
#1 src/addons/XFRM/ControllerPlugin/ResourceIcon.php(32): SV\AttachmentImprovements\XFRM\Service\ResourceItem\Icon->updateIcon()
#2 src/addons/XFRM/Pub/Controller/ResourceItem.php(1275): XFRM\ControllerPlugin\ResourceIcon->actionUpload(Object(SV\AttachmentImprovements\XFRM\Entity\ResourceItem))
#3 src/XF/Mvc/Dispatcher.php(362): XFRM\Pub\Controller\ResourceItem->actionEditIcon(Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XFRM:ResourceIt...', 'EditIcon', Object(XF\Mvc\RouteMatch), Object(Siropu\AdsManager\XFRM\Pub\Controller\ResourceItem), NULL)
#5 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Siropu\AdsManager\XFRM\Pub\Controller\ResourceItem), NULL)
#6 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#8 src/XF.php(806): XF\App->run()
#9 index.php(23): XF::runApp('XF\\Pub\\App')
#10 {main}
 
Xon updated Attachment Improvements By Xon with a new update entry:

2.6.4 - Bugfix update

  • Fix edge case where thumbnails for an svg where not generated as expected
  • Fix XF2.3 support
    • Fix XFRM 2.3.x integration failing to save SVG icons.
    • Prevent XF2.3 converting svg attachments/xfrm icons to webp when optimizing images
    • Fix XF2.3 would convert an SVG to PNG client-side on submit
    • Fix svg attachments not generating thumbnail URLs as expected for X2.3

Read the rest of this update entry...
 
The webp optimization process will have silently failed to load the svg image, so nothing needs to be done.
 
With regards to the...
  • Option to strip jpeg EXIF data
Does this only apply to images that are uploaded after the install or does this run through the image database of the forum and strip out the existing data as well?
 
Only on upload, and this is done by re-encoding jpg images to remove the EXIF rather than just stripping it. I haven't had time to investigate a way todo this in php without re-encoding
 
I'm using this add-on with DigitalOcean Spaces on my website for 2 months now, and everything works fine, but for some reason Firefox is not able to resume downloads. I tried on multiple machines PC/Mac and it always fails. Chrome and Safari can resume with no problems.

Am I missing some extra add_header in nginx config?
 
  • 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
 
  • 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'ld need to see the stack trace.

Are you storing attachments in s3 or something?
 
I'ld need to see the stack trace.

Are you storing attachments in s3 or something?
Yes, using Cloudflare

I see DBTech Security also mentioned in the trace

Code:
[HEADING=2]Stack trace[/HEADING]
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] fse...', '/home/nginx/dom...', 66)
#1 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(66): fseek(Resource id #7, 1954472)
#2 src/addons/SV/AttachmentImprovements/PartialResponseStream.php(116): SV\AttachmentImprovements\PartialResponseStream->readChunks(true)
#3 src/XF/Http/ResponseStream.php(27): SV\AttachmentImprovements\PartialResponseStream->getContents()
#4 src/addons/DBTech/Security/Listener.php(201): XF\Http\ResponseStream->__toString()
#5 src/XF/Extension.php(81): DBTech\Security\Listener::dispatcherPostRender(Object(XF\Mvc\Dispatcher), Object(SV\AttachmentImprovements\PartialResponseStream), Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Raw), Object(XF\Http\Response))
#6 src/XF/App.php(3020): XF\Extension->fire('dispatcher_post...', Array, NULL)
#7 src/XF/Mvc/Dispatcher.php(409): XF\App->fire('dispatcher_post...', Array)
#8 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'raw')
#9 src/XF/App.php(2513): XF\Mvc\Dispatcher->run()
#10 src/XF.php(524): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}[/code[
 
How are you using cloudflare? I assume it is via a 3rd party add-on?

My add-on has some assumptions around ranged content support which require files to be stored locally and somehow this assumption isn't working. I'll need to know more about how your attachment storage is setup.
 
Back
Top Bottom