File Attachments in Mantis 1.2RC2
Moderators: Developer, Contributor
File Attachments in Mantis 1.2RC2
Hi Development Team!
I just did my first ever steps with Mantis (1.2RC2).
I really really love this software and don’t know why I was using Excel sheets for Bugtracking so long.
However, I have an issue with Mantis and I hope you are able to help me with that, as I couldn't find a thread here which seemed to be the correct answer for my problem:
Whenever I have an attachment to an issue, I am not able to view or use this information later on. In case of jpg or png attachments i get error messages like this:
SYSTEM WARNING: finfo::finfo() [finfo.finfo]: Failed to load magic database at ”.
SYSTEM WARNING: finfo::buffer() [finfo.buffer]: The invalid fileinfo object.
followed by loads of jabber of something that might be my pic:
‰PNG IHDR(„RדciCCPICC ProfilexízWTA×muOdfÈ99g$*’3ˆ….
followed by:
SYSTEM WARNING: Cannot modify header information – headers already sent by (output started at /PathToMantis/mantisbt/core/error_api.php:202)
If the attachment is a zip-file Mantis downloads a html file which looks very similar to the above.
Bug or Mistake on my side???
Help is very much appreciated
Holger
I just did my first ever steps with Mantis (1.2RC2).
I really really love this software and don’t know why I was using Excel sheets for Bugtracking so long.
However, I have an issue with Mantis and I hope you are able to help me with that, as I couldn't find a thread here which seemed to be the correct answer for my problem:
Whenever I have an attachment to an issue, I am not able to view or use this information later on. In case of jpg or png attachments i get error messages like this:
SYSTEM WARNING: finfo::finfo() [finfo.finfo]: Failed to load magic database at ”.
SYSTEM WARNING: finfo::buffer() [finfo.buffer]: The invalid fileinfo object.
followed by loads of jabber of something that might be my pic:
‰PNG IHDR(„RדciCCPICC ProfilexízWTA×muOdfÈ99g$*’3ˆ….
followed by:
SYSTEM WARNING: Cannot modify header information – headers already sent by (output started at /PathToMantis/mantisbt/core/error_api.php:202)
If the attachment is a zip-file Mantis downloads a html file which looks very similar to the above.
Bug or Mistake on my side???
Help is very much appreciated
Holger
Re: File Attachments in Mantis 1.2RC2
Hi kirill!
Thank you for your answer.
The PHP version used is:
PHP 5.3.0
I have replaced the file_download.php with the patch you've provided.
Now, I get a totally different error message:
APPLICATION ERROR #401
Datenbankabfrage fehlgeschlagen (database query failed). Die Reportmeldung lautet #1064:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'WHERE id=6' at line 3 for query: SELECT * FROM WHERE id=?.
And:
APPLICATION WARNING #100: Konfigurationsoption „bug_file“ nicht gefunden. (configuration option "bug_file" not found)
Sounds like I did make a mistake in configure Mantis correctly.
Can you help again ??
Thanx
Thank you for your answer.
The PHP version used is:
PHP 5.3.0
I have replaced the file_download.php with the patch you've provided.
Now, I get a totally different error message:
APPLICATION ERROR #401
Datenbankabfrage fehlgeschlagen (database query failed). Die Reportmeldung lautet #1064:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'WHERE id=6' at line 3 for query: SELECT * FROM WHERE id=?.
And:
APPLICATION WARNING #100: Konfigurationsoption „bug_file“ nicht gefunden. (configuration option "bug_file" not found)
Sounds like I did make a mistake in configure Mantis correctly.
Can you help again ??
Thanx
Re: File Attachments in Mantis 1.2RC2
Just assumptionHolger wrote: The PHP version used is:
PHP 5.3.0
5.3.x seems not to be a good version for MantisBT at the moment
For example have a look at:
http://www.mantisbt.org/bugs/view.php?id=11048
As these are your first steps with MantisBT, starting with environments that are known as stable might be a better way for you.
Re: File Attachments in Mantis 1.2RC2
I ran into the same issue myself when upgrading from 1.1.8 to 1.2. The patch does indeed work, but with a little tweaking. Either way I can once again view attached screen shots. Thanks for the patch!
previous code in the patched file_download.php, starting line 45
And the same code with changes, just updated the db_get_table to the correct string. I also put $c_file_id directly into the query string and removed the array op including it from the db_query call. Doing so stopped the first mysql error, replacing the table names stopped the second and allowed the patched file_download.php do it's thing.
previous code in the patched file_download.php, starting line 45
Code: Select all
switch ( $f_type ) {
case 'bug':
$t_bug_file_table = db_get_table( 'bug_file' );
$query = "SELECT *
FROM $t_bug_file_table
WHERE id=" . db_param();
break;
case 'doc':
$t_project_file_table = db_get_table( 'project_file' );
$query = "SELECT *
FROM $t_project_file_table
WHERE id=" . db_param();
break;
default:
access_denied();
}
$result = db_query_bound( $query, Array( $c_file_id ) );
$row = db_fetch_array( $result );
Code: Select all
switch ( $f_type ) {
case 'bug':
$t_bug_file_table = db_get_table( 'mantis_bug_file_table' );
$query = "SELECT *
FROM $t_bug_file_table
WHERE id=" . $c_file_id;
break;
case 'doc':
$t_project_file_table = db_get_table( 'mantis_project_file_table' );
$query = "SELECT *
FROM $t_project_file_table
WHERE id=" . $c_file_id;
break;
default:
access_denied();
}
$result = db_query_bound( $query );
$row = db_fetch_array( $result );
Re: File Attachments in Mantis 1.2RC2
Hi everybody!,
I have the same problem.
I'm updated a mantis 1.0.6 (yes, very old ) to 1.2.0rc2 for use the mail to issue plugin (for 1.2.0rc2)
My scenario configuration:
Windows 7 64bit
As I read that php 5.3.x seems not a good version for this rc2, i'm choose the xampp 1.5.5 that have a php 5.2.0 version.
For use the "mime magic" or "fileinfo" extension, I'm uncommented the line "extension=php_fileinfo.dll" in the php.ini file. xampp is installed by default magic extension.
Still, it seems not recognice the class "finfo", and $content_type is not properly informed.
At the moment, i'm solved the problem with this "fix", from the line 140 in every if($finfo_available){, i'm added:
This appears to work well, since we use the file type that is registered in the database
Also, when a file is download, ever the default name of the file is "file_download.zip, or file_download.jpg, etc...
This i'm fixed editing the line 108:
for this:
So far it seems to work correctly.
Si alguien tiene alguna idea de porque no está funcionando de la otra manera, se lo agradeceré any idea.
Thanks!
(and excuse my english )
I have the same problem.
I'm updated a mantis 1.0.6 (yes, very old ) to 1.2.0rc2 for use the mail to issue plugin (for 1.2.0rc2)
My scenario configuration:
Windows 7 64bit
As I read that php 5.3.x seems not a good version for this rc2, i'm choose the xampp 1.5.5 that have a php 5.2.0 version.
For use the "mime magic" or "fileinfo" extension, I'm uncommented the line "extension=php_fileinfo.dll" in the php.ini file. xampp is installed by default magic extension.
Still, it seems not recognice the class "finfo", and $content_type is not properly informed.
At the moment, i'm solved the problem with this "fix", from the line 140 in every if($finfo_available){, i'm added:
Code: Select all
if ( $finfo_available ) {
if ( $content_type = $finfo->file( $t_local_disk_file ) ) {
header( 'Content-Type: ' . $content_type );
}
}else{
header( 'Content-Type: ' . $v_file_type );
}
Also, when a file is download, ever the default name of the file is "file_download.zip, or file_download.jpg, etc...
This i'm fixed editing the line 108:
Code: Select all
header( 'Content-Disposition:' . $t_disposition . ' filename*=UTF-8\'\'' . urlencode( $t_filename ) . '; filename="' . urlencode( $t_filename ) . '"' );
Code: Select all
header( 'Content-Disposition: attachment; filename="' . urlencode( $v_filename ) . '"' );
Si alguien tiene alguna idea de porque no está funcionando de la otra manera, se lo agradeceré any idea.
Thanks!
(and excuse my english )
Re: File Attachments in Mantis 1.2RC2
Hi all!
I am amazed by the excellent quality of the posts in this forum!!
For an absolute beginner with Mantis this is like a warm shower - or nice christmas presents!
Looks like protatoe did a very good job in patching the patched file.
All attachment data already in the database is now viewable or usable.
However , I am still not able to upload attachments to new or existing bugreports.
This gives me an 401 error and asks me to use the browsers back button...
Any ideas on this as well
THANKS SO MUCH
I am amazed by the excellent quality of the posts in this forum!!
For an absolute beginner with Mantis this is like a warm shower - or nice christmas presents!
Looks like protatoe did a very good job in patching the patched file.
All attachment data already in the database is now viewable or usable.
However , I am still not able to upload attachments to new or existing bugreports.
This gives me an 401 error and asks me to use the browsers back button...
Any ideas on this as well
THANKS SO MUCH
Re: File Attachments in Mantis 1.2RC2
Try this settings in config_inc.php
Code: Select all
$g_display_errors = array(
E_WARNING => 'inline',
E_NOTICE => 'inline',
E_USER_ERROR => 'halt',
E_USER_WARNING => 'inline',
E_USER_NOTICE => 'inline'
);
Re: File Attachments in Mantis 1.2RC2
I have the same problem
My Env:
Must change the php to 5.2?
My Env:
The solutions of above are not work for mephp: 5.3.0
CentoOS
Apache 2.2.3
Must change the php to 5.2?
Re: File Attachments in Mantis 1.2RC2
Hello.Holger wrote:Hi Development Team!
...
Bug or Mistake on my side???
Help is very much appreciated
Holger
I had the same problem, when started migrate from 1.0.6 to 1.2.0, but i found the solution:
1). open file $MANTIS_DIR/file_download.php
2). find key string "if ( class_exists( 'finfo' ) ) {" and replace it with "if ( false ) {" and save the document.
Good luck!