View Issue Details

IDProjectCategoryView StatusLast Update
0011722mantisbtapi soappublic2010-09-19 03:12
Reportergonfva Assigned Torombert  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0 
Summary0011722: Problems attaching binary files
Description

I have Mantis version 1.2.0 and I'm trying to send binary files via SOAP.

I'm sending base64 encoded data, and then I try to get the attachment as the usual binary download. The nulls in the original file, get converted to \0 ("slash zero") in the downloaded file.

Steps To Reproduce

1.-Try to add via SOAP a file with only 3 bytes, all null (00 00 00). You send it base64 encoded as four 'A' (char 41 41 41 41)
2.-Download the file and view with an hex editor. Instead of a file with the three nulls you get \0\ (5C 3C 5C)

In other words I send AAAA via SOAP(which is the encoding for three nulls) and I get a file with 3 "\0" ("slash zero") strings

Additional Information

File persist in database in my case.

I think the problem is that when trying to save the file in the database we're inserting a String which gets converted nulls to \0 ("slash zero")

I've managed to solve for me, not encoding in mc_issue_attachment_api.php, but on mci_file_api.php. For the record here comes the changes:
line 54 of mc_issue_attachment_api.php:
return mci_file_add( $p_issue_id, $p_name, $p_content , $p_file_type, 'bug' );
line 43 of mc_file_api.php:
$t_file_size = strlen( base64_decode($p_content) );
line 95 of mc_file_api.php:
mci_file_write_local( $t_disk_file_name, base64_decode($p_content ));
line 110 of mc_file_api.php:
$c_content = db_prepare_binary_string( base64_decode( $p_content ));

Maybe related to bugs 0011151, 0011039

TagsNo tags attached.

Activities

rombert

rombert

2010-04-28 14:57

reporter   ~0025338

I've committed a fix in the soap-attachments branch ( commit at http://git.mantisbt.org/?p=mantisbt.git;a=commit;h=b836b267cfc77aa516968fe05d1804743df133d7 ). Please verify that it does solve the problem you've reported.

rombert

rombert

2010-05-16 05:27

reporter   ~0025508

This was fixed for bug 0011151.