Kunena 7.1.0 Released

The Kunena team has announce the arrival of Kunena 7.1.0 [K 7.1.0] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x./6.1.x./6.2.x This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 / K7.0 and issues discovered during the last development stages of K 7.1
Just a reminder: K6.4.16 receives only securities fixes until end of 2026, so it's advised for users to upgrade to K7.1.

Question Display of PDFs in messages stopped working

More
1 month 5 days ago - 1 month 4 days ago #235406 by btc
I started this thread six weeks ago with the title Is it possible to revert from K7.0.8 to K6.4? and  9themestore  got involved. However, because of being very busy with some urgent matters I wasn't able to take up his offer and haven't been able to work on this further until today.

The thread title is in fact misleading, the real issue was that after I moved from K6.4 to K7.0, the display of PDFs in messages stopped working - both when using a 9themstore template and when using the default template.. I've now found a workround that works:

Instead of using the full path to the PDF file I edited template/system/layouts/bbcode/attachment/pdf.php to use a relative link and now everything works properly.

After line 21 I added $location = substr($location,21); to remove the first part of the URL - in my case this removes https://www,pgweb.uk/ - which is 21 characters long. 

I wonder whether the cause could be some hardening of security by the developers of Joomla or one of the extensions that I use? But why have other users not encounterd this issue?

The solution that I found is not of course applicable across the board because it depends on the number of characters in the base URL for each specific website.
Edit Pinkeltje: I've changed the topic subject.
 
Last edit: 1 month 4 days ago by Pinkeltje.

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago - 1 month 5 days ago #235410 by xillibit
Hello,

In your case you have setting attachment protected disabled, so this issue could be caused by SEF settings.
The method which generate URL for pdf embeded in message is here :  github.com/Kunena/Kunena-Forum/blob/K6.4...aAttachment.php#L584

Do-you use the htaccess without changes in it or there is changes in it ?

I don't provide support by PM, because this can be useful for someone else.
Last edit: 1 month 5 days ago by xillibit.

Please Log in or Create an account to join the conversation.

More
1 month 5 days ago - 1 month 5 days ago #235412 by Pinkeltje
I've looked into this. The PDF part of Kunena hasn't changed between K6.4 and K7.0: pdf.php and the getUrl() method in KunenaAttachment work the same way in both versions. So this isn't caused by Kunena 7 itself.
I checked the direct URL of one of your PDFs (/media/kunena/attachments/773/20260709_075242.pdf): it returns 200 OK with Content-Type: application/pdf, so the .htaccess doesn't seem to block the file itself.

A few things I noticed on your site:
  1. Your attachments aren't protected (the PDF has its normal filename), so that setting isn't the issue.
  2. The PDF is served correctly by your server (Content-Type: application/pdf, same origin, www redirect is fine).
  3. The wf-responsive classes and the ?ts= parameter on your <object> come from the Responsify plugin (by the JCE developers), not from Kunena. I tested Responsify on my own test site, though, and the PDF still displayed fine there.

Could you please:
  1. Restore the original pdf.php (remove your substr change)
  2. Clear the JCH Optimize cache and do a hard refresh (Ctrl+F5)
  3. If the PDF still doesn't show, open the browser console (F12) and post any error messages here, together with the rendered <object> line from the page source.

That way we can see what is actually blocking it on your site.
Last edit: 1 month 5 days ago by Pinkeltje.

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago #235415 by btc
Thanks for looking into this.

I compared the <object> line in the source with the original pdf.php file and with my edited pdf.php file. In the former case the url has a forward slash that shouldn't be there, so no wonder it's not displaying the PDF!

This is the <object> line with pdf.php unaltered
Code:
<object class="pdf pdf-viewer wf-responsive wf-responsive-full" data="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" type="application/pdf" data-src="https/://www.pgweb.uk/media/kunena/attachments/1657/PressRelease2-EnoughisEnoughAugust2025.pdf" >

Where has that extraneous / come from? Presumably it's something that I've done somewhere (I have done a certain amount of tweaking of things over the years). 

This the <object> line with my added line (PDF displays properly)
Code:
<object class="pdf pdf-viewer wf-responsive wf-responsive-full" data="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" type="application/pdf" data-src="/media/kunena/attachments/1657/PressRelease2-EnoughisEnoughAugust2025.pdf" >

I have to confess to doing some editing to libraries/kunena/src/BBCode/KunenaBBCode.php to make some changes to how forum content is displayed on various parts of the website. However, on a development version of the website I have substituted the current version of that file from Github and it hasn't fixed the problem.

For the time being I'll stick with my edited version of pdf.php on the live website while I work on the development website to trace the source of the problem. Looks like I've caused this myself, so I can't expect the Kunena team to fix it for me!

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago - 1 month 3 days ago #235416 by Pinkeltje
Sounds like a plan. And you should never ever change core files. Try making overrides for views or try using Rereplacer from Regularlabs first to make your changes. 
Or keep a log file somewhere with your changes if everything else fails.
And maybe disable JCH optimize to test. Might be the cause of your problem as well.
Last edit: 1 month 3 days ago by Pinkeltje.

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds