1 (edited by diigiit 04/13/2018 08:24:54 pm)

Topic: Failed to load PDF document

Hello,
This is a very weird bug and still try to understand it. Hope someone can help.
I was working on company accounting adding journal entries and attaching PDF file for each invoice entered. Frontaccounting is online. Everything was working ok (in fact it is working since months). Was able to attach and see PDF invoices in Frontaccounting.
Suddenly, with no reason, PDF attachments stopped working with error message "Failed to load PDF document".
Release number is 2.3.22.
I first suspected a corrupted attached file or a browser issue. The problem is the same whether I am using Firefox or Chrome.
The weird thing is that the problem is the same on any other computer including the one that are using a local database and installation.
After investigation, it looks like the problem is located inside /admin/attachments.php
The piece of code
echo file_get_contents(company_path(). "/attachments/".$row['unique_name']);
point to a non existing file; $row['unique_name'] return unique_name found on 0_attachments table for the file but this file does not exists under company/0/attachments/ repository.
Backups files shows exactly the same thing.
How attached file are stored?

Re: Failed to load PDF document

Was able to solve the problem. Actually, for some reason, permission on attachments repository was changed. Add the +rw permission. Solved my problem.