-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error Downloading Attachments #671
Comments
I've expanded the code in the repository to log an error and return a string, as it is supposed to. However, it is difficult to debug why the file was not uploaded properly. Do you see a connection between the failed files? Are they of a specific type, of a specific size (before upload)? |
All attachments are PDFs, however not all PDFs fail like this. I think the issue is somewhere during the upload process since a 4 MB PDF is being saved as a 192 B file. If a PDF fails, it will always fail. I can delete and re-upload it repeatedly and attempts to download it will always result in this error (I might be able to email you one that I know doesn't work; let me know). Some PDFs I get from others, many I just create on my Mac (macOS Sierra) by printing to PDF. I cannot confirm if size is an issue as I don't use this feature a lot, but all files that have failed are over 512 KB. The largest is just under 4 MB. Is there an easy way to decrypt on of the failed uploads? I'd be curious to see the contents of the file since the file size is so dramatically different. |
I recently updated my PHP and Nginx settings to allow 32 MB uploads. I noticed the issue began around that time, however the upload form clearly shows 32 MB as the limit. The conf changes were also made when I updated to 4.4.2 (though I'm now running 4.5.0). Largest file upload is 4 MB. Is there an easy way to decrypt on of the failed uploads? I'd be curious to see the contents of the file since the file size is so dramatically different. |
edit: sorry, this won't work. Probably the encryption routine fails completely so it's impossible to say. |
Oh, add this to your nginx config:
|
I've done a bunch of tests and as near as I can tell, there is some element of the PDF files that's causing the failure. I can take an image and "print to PDF" and it works. I can print to PDF a word processing document and it works. I can also upload images. But just those handful of PDFs fail so I'm guessing whatever is parsing the document when it's uploaded is choking on something in the file. Can I send you one of the PDFs that's failing by email? |
Of course, send it to thegrumpydictator@gmail.com. If you wish to use PGP, use this key. |
Sent. |
I've added some debug information to AttachmentHelper.php. See also the commit. If you replace your version of that file, a log entry should appear. In my case it seems to work, and the result is this:
Take note of the MD5 and the content lengths. Are they the same? |
Replaced the file; however, nothing about the attachment is being logged. (Made sure |
Alright then the file doesn't "arrive" at FF and we need to get a closer look. Open "app/Http/Controllers/Transaction/SingleController" and find the following line. It should be there twice.
Enter the following on the line above (two times):
This should give you some debugging information on the actual input received. |
I'm still not getting anything logged. Is there a cache I need to clear? (I've already disabled Opcache, though it was still set to stat files for changes anyway.) |
Darn, that makes it difficult. Yes, try these commands to clear some logs:
What does Open the folder storage/logs. I take it those files do log other things? |
Yes, .env contains
So the uploaded file is making it to Firefly, but I'm guessing at some point with encryption it's failing. But only on some files, most work. mcrypt module is installed and enabled per your site's requirements (though mcrypt is deprecated as of PHP 7, which is what I'm running). (This really feels like a platform issue--I'm running this in a FreeBSD 10 jail--but I'd still like to resolve it.) |
MCrypt can be removed. It is decrepated as you mention and the docs should no longer talk about it. It might just be the problem. The encrypt routine uses openSSL in the background. An exception should be raised when the content cannot be encrypted but this exception may not make it to the front-end. |
I removed MCrypt. Tried the upload again. Issue persists. OpenSSL PHP library was always installed. |
Edit: Ignore this comment's original content; I messed up the redirects in the terminal. :) I took one of the failed uploads (e.g. at-##.dat files) and ran it through |
Damn. I'll see if I can write a small decryption routine this weekend, it may aid in finding out what it says. |
Alright so I completely forgot about this. There is a new command that you may use to decrypt files and store the result somewhere. It uses the same routines as the original download button does so it might fail as badly as the attachment download routine, but it can be edited (by me) to be more manual. That way, I hope you can extract the content of the files and see what's wrong.
And an example
|
The next release will include this routine. This release will require PHP7.1 |
The new release is live! |
My apologies for not following up sooner. Back in the summer I attempted to debug this thoroughly. I put debug code in all the way up to the actual PHP command to encrypt the file. Everything works right up to the point where OpenSSL is asked to encrypt; the file it spits out after that is corrupt (just a few bytes in size). I'm certain this means the issue not with Firefly at all but rather the openssl PHP module being used in FreeBSD 10. I also setup a test environment using Debian 9, Nginx, MariaDB and PHP 7.1. I imported my production database and attempted to upload one of the files that always failed (same one I emailed you previously). It worked without issue. So as far as I'm concerned this issue is outside the scope of your application. I'm just going to switch my install to Debian and be done with it. Thanks for all your help along the way. |
Alright, thanks for the follow-up, don't worry about it. I'm "glad" its outside of FF3. ;). If you have any more issues, with encryption or otherwise, you know where to find me 👍 |
Running 4.4.2 (issue began with this version) and when I click an attachment in a transaction I get the following error:
This error does not occur for every attachment, but it does occur for quite a few. Version 4.4.2 introduced the new "has x attachments" trigger in rules but I don't know if it's related.
The actual attachment files saved to the server might be corrupt as the affected ones are only 188 B - 192 B (actual bytes, not kilobytes).
Can confirm the issue exists in 4.5.0.
The text was updated successfully, but these errors were encountered: