View Issue Details

IDProjectCategoryView StatusLast Update
0015551mantisbtapi soappublic2014-11-07 02:14
Reporterluismiguel.cabezas Assigned Torombert  
PrioritynormalSeveritytweakReproducibilityalways
Status closedResolutionno change required 
PlatformLinuxOSDebianOS Version5
Product Version1.2.14 
Summary0015551: mc_issue_attachment_add save corrupt file
Description

Hi,

i am trying to send a file through SOAP with mc_issue_attachment_add. All ok but whn i see de database data are in base64 and not in binary format (if i use a form the file save perfect).

I have modified function mci_file_add for solve this problem.

i have add:

if( 'bug' == $p_table ) {
    $t_project_id = bug_get_field( $p_id, 'project_id' );
    $t_issue_id = bug_format_id( $p_id );
            $p_content = base64_decode($p_content);
} else {

If a file come through SOAP $p_content is save after decode.

Is solved to me. Is correctly this patch?

Thanks!!!

TagsNo tags attached.

Activities

rombert

rombert

2013-03-07 16:10

reporter   ~0035410

For me uploading attachments works just fine. How exactly do you add the file? Also, I'm interested in knowing if you have the php soap extensions activated or have made any modifications in api/soap/mc_config_inc.php.

dregad

dregad

2013-03-08 04:27

developer   ~0035411

@rombert, I vaguely recall there were some issues and possibly discrepancies in the file_add API calls between MantisBT and SOAP. I had started working on this several months ago [1] but never actually got around to finishing the job. Maybe this is related.

[1] https://github.com/dregad/mantisbt/tree/file-attach-fixes

luismiguel.cabezas

luismiguel.cabezas

2013-03-08 06:33

reporter   ~0035415

upload a file works fine. SOAP in server.

The problem is when i try upload a file with SOAP.

I use Ruby to attach a file with SOAP and code the file with Base64.

The function mc_issue_attachment_add need decode base64 to save in db if the file come about SOAP.

My code solve this problem.

rombert

rombert

2013-03-08 06:38

reporter   ~0035417

I think I know what's going on here. Probably your ruby SOAP library already encodes the file in Base64 for you. The Axis toolkit ( Java ) and PHP SOAP extension ( IIRC ) already do that. Try removing the Base64 encoding from your code and see what that does.

rombert

rombert

2013-03-08 06:41

reporter   ~0035418

@rombert, I vaguely recall there were some issues and possibly discrepancies in the file_add API calls between MantisBT and SOAP. I had started working on this several months ago [1] but never actually got around to finishing the job. Maybe this is related

I remember those, but I think this is unrelated. I've had my mistakes spelled out to me regarding attachments and Base64 encoding in bug 0011151, bug 0011471 and bug 0011039 so I'm pretty confident that this is done right.

dregad

dregad

2014-09-26 12:49

developer   ~0041312

Based on a quick research I did today following a message on the mailing list [1] I wonder if this could be due to encoding the attachment twice (the PHP SOAP extension apparently handles the base64_encoding, according to [2] - not sure if nusoap does the same)

[1] http://article.gmane.org/gmane.comp.bug-tracking.mantis.general/3548
[2] http://php.net/manual/en/soapclient.soapclient.php#98658

rombert

rombert

2014-09-26 15:06

reporter   ~0041313

Right, so the problem there was that the developer was encoding the data himself. But we can't control the client side, all we do is ensure that the data is correctly handled on the server side.

vboctor

vboctor

2014-10-25 18:19

manager   ~0041662

Php soap client automatically encodes as well. Resolving as no change required.