Corrupted Downloads
-
All attachments (PSDs and PDFs tested) downloaded through the plugin are being corrupted somehow. They download fine using the links in the admin interface.
I fixed / worked around this by doing two things. First, commenting out ob_clean(); at the bottom of function wcpoa_send_file, line 185 in class-woocommerce-product-attachment-public.php . There’s no ob_start() call anywhere in the plugin that I can see, so ob_clean() and ob_end_flush() won’t do anything anyway (except break files, apparently).
That nearly fixed the files, however when opened with a text editor, they all began with a PHP warning about the filesize stat call failing. According to the PHP manual, using stat on files accessed through https:// is not supported.
So the second fix was switching the filesize call directly above ob_clean() to use a local file path instead of a URL path. For this I added a $file_path variable with the following line of code:
$file_path = get_attached_file($attID);
Could you please evaluate these bugs and fixes and incorporate them into the next release?
This is on a server running PHP 7.1 and Apache 2.4 with mod_http2.
- The topic ‘Corrupted Downloads’ is closed to new replies.