attachment_preview icon indicating copy to clipboard operation
attachment_preview copied to clipboard

Plugin no longer works on osTicket 1.18

Open buff0k opened this issue 1 year ago • 13 comments

I upgraded my osTicket deployment to 1.18.1 and discovered that the plugin no longer functions. Am looking into the code but I suspect it may ba the javascript not really playing nice with osTicket 1.18.

buff0k avatar Nov 02 '23 19:11 buff0k

Can also confirm that the same problem exists with 1.17.5

buff0k avatar Nov 02 '23 19:11 buff0k

[10-Nov-2023 06:34:06 UTC] PHP Fatal error: Cannot make non static method Plugin::getInstance() static in class AttachmentPreviewPlugin in /include/plugins/attachment_preview/class.AttachmentPreviewPlugin.php on line 83

buff0k avatar Nov 10 '23 06:11 buff0k

Same issue here.

jabrugger avatar Nov 13 '23 11:11 jabrugger

Hi everyone,

We found a temporary solution for this bug, simply install this plugin in Chrome or Edge: https://chromewebstore.google.com/detail/pdf-viewer/oemmndcbldboiebfnladdacbdfmadadm

After install you must allow the active content (javascript) and File URL permission in the plugin's settings.

nandi96 avatar Nov 22 '23 21:11 nandi96

Hello, is there any solution for this problem? Is this plugin still under development? We have the same problem, that the pdf is not displayed inline. We are on osticket 1.18.1 and PHP 8.2.

I will test the chrome app but it would be nice if the plugin could be updated. Are there any plans?

Best regards

phatair avatar Jan 08 '24 07:01 phatair

Hello, I'm using this plugin with osTicket 1.18.1 with apache server, after initial challenges now works great, need to add new header in your apache virtualhost config: Header set Content-Security-Policy "object-src 'self' blob:;"

impedator avatar Mar 05 '24 13:03 impedator

Tested, it works!

nandi96 avatar Mar 05 '24 15:03 nandi96

@impedator does not work for me, pdfs still only showing blank.

buff0k avatar Mar 06 '24 06:03 buff0k

@buff0k did you checked browser console for errors when opening page with ticket? please provide some info about environment.

impedator avatar Mar 06 '24 07:03 impedator

@impedator the issue I am geetting now is: Refused to load plugin data from '' because it violates the following Content Security Policy directive: "object-src 'none'".

Note that I am using Nginx with the header included by: add_header Content-Security-Policy "object-src 'self' blob:;";

I'm going to check other headers that might conflict.

buff0k avatar Mar 06 '24 07:03 buff0k

@buff0k - try: add_header Content-Security-Policy "object-src '*' blob:;"; and check if this is working ok, if yes then investigate proper domain or source, remember that it is not a good idea to use * there ;-)

impedator avatar Mar 06 '24 08:03 impedator

@impedator I am now hitting: Refused to load plugin data from '' because it violates the following Content Security Policy directive: "object-src '*' blob:". Not sure what is causing this but now Console also reports: Refused to load plugin data from '' because it violates the following Content Security Policy directive: "object-src 'none'".

So Nginx is applying both policies but neither is passing it through as it runs into the none policy, I need to figure out what is setting that.

buff0k avatar Mar 06 '24 08:03 buff0k

Look this -> https://github.com/osTicket/osTicket/pull/6624

nandi96 avatar Mar 06 '24 12:03 nandi96

Any news?

I have currently applied changes by @impedator

https://github.com/impedator/osTicket/commit/3e40543faf4fbf206f9b8adc9529008d388ee5a9#diff-9d3ede82cbb2ca67574bfe9f98bf9ccce84ccb967cadf16cb0ed80ce66d64363R3

Cm-8 avatar Sep 26 '24 13:09 Cm-8