clonemeagain / attachment_preview

osTicket Plugin: Allows inline view of attachments
GNU General Public License v2.0
48 stars 16 forks source link

Printing as ZIP results in malformed ZIP #49

Open sevmonster opened 4 years ago

sevmonster commented 4 years ago

For example, http://osticket/scp/tickets.php?id=1&a=zip results in these warnings:

PHP Warning:  file_get_contents(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 169
PHP Warning:  file_get_contents(phar://osticket/include/plugins/attachment_preview.phar/stylesheet.css): failed to open stream: No such file or directory in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 169
PHP Warning:  file_get_contents(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 186
PHP Warning:  file_get_contents(phar://osticket/include/plugins/attachment_preview.phar/script.js): failed to open stream: No such file or directory in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 186

And ignoring those warnings spits out the following malformed ZIP file:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>PK</p><script></script>
</body></html>

I assume the NUL in the ZIP is causing the rest of the file to not display in the <p> tag.

image

clonemeagain commented 4 years ago

Printing as zip? I'm guessing we need to update the is ticket algorithm

On Fri, 23 Oct 2020, 08:30 ds6, notifications@github.com wrote:

For example, http://osticket/scp/tickets.php?id=1&a=zip results in these warnings:

PHP Warning: file_get_contents(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 169 PHP Warning: file_get_contents(phar://osticket/include/plugins/attachment_preview.phar/stylesheet.css): failed to open stream: No such file or directory in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 169 PHP Warning: file_get_contents(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP? in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 186 PHP Warning: file_get_contents(phar://osticket/include/plugins/attachment_preview.phar/script.js): failed to open stream: No such file or directory in phar://osticket/include/plugins/attachment_preview.phar/class.AttachmentPreviewPlugin.php on line 186

And ignoring those warnings spits out the following malformed ZIP file:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

PK

I assume the NUL in the ZIP is causing the rest of the file to not display in the

tag.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/clonemeagain/attachment_preview/issues/49, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGXTDY34XAKUTH7ZMEZEV3SMCQALANCNFSM4S3X7W5Q .

sevmonster commented 4 years ago

Yes; don't know if you've seen it or when it was added, but this is what the current Print option looks like for a ticket in the SCP: image The bottom two choices provide a ZIP file with attachments included.

crazy-mc commented 10 months ago

Hi are there any updates to this issue? My team love this plugin but every time they have to create a zip i must deactivate it and reactivate when it's done. Next time we want to update to 1.18 but i see there are also problems with compatibility