Fix Mantis corrupt attachment files

Fix attached files

After upgrading to the latest Mantis version, I had a problem with zip attachments being corrupted when downloaded from Mantis. Turns out his error message is added to the files:

SYSTEM WARNING: ‘finfo::finfo() [finfo.finfo]: Failed to load magic database at ‘/etc/magic’.’ in ‘/srv/sites/’ line 273

To fix the problem I had to manually configure the proper path to the magic file on the server.

First I located the magic database file through the man page for magic

# man magic

magic – file command’s magic number file

This manual page documents the format of the magic file as used by the file(1) command, version 4.17. The file command identifies the type of a file using, among other tests, a test for whether the file begins with a certain magic number. The file /usr/share/file/magic specifies what magic numbers are to be tested for, what message to print if a particular magic number is found, and additional information to extract from the file.

Then I added a new configuration entry to the Mantis configuration file: config_inc.php. This file is located at the root of the Mantis folder and can be edited by any text editors such as nano, pico or vi.

$g_fileinfo_magic_db_file = '/usr/share/file/magic'

Leave a Reply

Your email address will not be published. Required fields are marked *