View Issue Details

IDProjectCategoryView StatusLast Update
0011039mantisbtapi soappublic2010-04-28 14:44
ReporterMAGMA Assigned Torombert  
PrioritynormalSeveritymajorReproducibilityhave not tried
Status closedResolutionno change required 
Product Version1.2.0rc2 
Target Version1.2.0Fixed in Version1.2.0 
Summary0011039: mc_issue_attachment_get() returns garbage
Description

As mc_issue_attachment_add() expects the attachment data to be base64 encoded, mc_issue_attachment_get has to return the attachment data base64 encoded, too.

A working patch has been provided as "Additional Information"

Steps To Reproduce
  1. Call mc_issue_attachment_add(..., string1)
  2. string2 = mc_issue_attachment_get(...)
  3. Observe string1 != string2 and string2 looks like garbage
Additional Information

diff -r 2f192cbf1207 api/soap/mc_issue_attachment_api.php
--- a/api/soap/mc_issue_attachment_api.php Mon Oct 12 14:42:22 2009 +0200
+++ b/api/soap/mc_issue_attachment_api.php Wed Oct 14 14:53:21 2009 +0200
@@ -21,7 +21,7 @@
if( $t_user_id === false ) {
return new soap_fault( 'Client', '', 'Access Denied' );
}

  • return mci_file_get( $p_issue_attachment_id, 'bug', $t_user_id );
  • return base64_encode( mci_file_get( $p_issue_attachment_id, 'bug', $t_user_id ));
    }

    /**

TagsNo tags attached.

Relationships

related to 0010892 closedrombert followup of 0010235 : can't add binary attachment with cropper because attachment is base64-decoded twice 
related to 0010235 closedgiallu mc_issue_attachment_add corrupts attachments 

Activities

rombert

rombert

2009-10-14 09:09

reporter   ~0023184

See 0010892 and 0010235.

MAGMA

MAGMA

2009-10-14 09:54

reporter   ~0023188

OK, you've already fixed it in on the 1.1 branch. Please don't forget to merge the fix for the 1.2 release. Thankx.

rombert

rombert

2009-10-25 16:44

reporter   ~0023316

The related changesets list this being fixed in both branches. Please confirm that it still does not work for you.

MAGMA

MAGMA

2009-10-26 03:57

reporter   ~0023324

I have shortly reviewed the lastest versions of api/soap/mc_issue_attachment_api.php in the "master-1.2.x" and "master" development branches. Visually the error is still there.

rombert

rombert

2009-10-29 19:20

reporter   ~0023478

I have manually tested this issue using SOAP UI.

The request-reponse cycle for mc_issue_attachment_get is:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://futureware.biz/mantisconnect">
<soapenv:Header/>
<soapenv:Body>
<man:mc_issue_attachment_get soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<username xsi:type="xsd:string">administrator</username>
<password xsi:type="xsd:string">root</password>
<issue_attachment_id xsi:type="xsd:integer">9</issue_attachment_id>
</man:mc_issue_attachment_get>
</soapenv:Body>
</soapenv:Envelope>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:mc_issue_attachment_getResponse xmlns:ns1="http://futureware.biz/mantisconnect">
<return xsi:type="xsd:base64Binary">c2FtcGxlIGNvbnRlbnRz</return>
</ns1:mc_issue_attachment_getResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Please note the contents - it is base64 encoded. Furthermore, all execution paths of mci_file_get return base64-encoded content.

I did observe that the PHP soap extension on the client side already decodes the base64 contents. I suppose that's a feature, and as long as plain XML requests do the right thing there is nothing to fix.

Please reopen if you think this is not correct.

rombert

rombert

2010-04-28 14:44

reporter   ~0025335

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.

Related Changesets

MantisBT: master-1.2.x d880d59a

2009-10-29 19:25

rombert


Details Diff
Issue 0011039: mc_issue_attachment_get() returns garbage

This commits adds a test which verifies that the contents of an
attachment is properly encoded and decoded.
Affected Issues
0011039
mod - tests/soap/AllTests.php Diff File
add - tests/soap/AttachmentTest.php Diff File

MantisBT: master d47ded46

2009-10-29 19:25

rombert


Details Diff
Issue 0011039: mc_issue_attachment_get() returns garbage

This commits adds a test which verifies that the contents of an
attachment is properly encoded and decoded.
Affected Issues
0011039
mod - tests/soap/AllTests.php Diff File
add - tests/soap/AttachmentTest.php Diff File