From: <gi...@ma...> - 2010-05-12 20:19:01
|
The branch, master has been updated via dd2846611ca5b82a0dd061369eebd796857bbfa6 (commit) from 8277d9638c9b79f97585ca402ce1150baf948690 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dd2846611ca5b82a0dd061369eebd796857bbfa6 Author: Robert Munteanu <rob...@gm...> Date: Wed Apr 28 21:25:42 2010 +0300 Only decode attachments once when using the SOAP API Attachments uploaded using the SOAP API calls are decoded by NuSOAP. Up till now, we are also decoding the attachments, which caused the attached files to be unreadable. Although workarounds do exist, the correct way is to let NuSOAP apply the Base64-decoding. The requirement for the users of the SOAP API is to Base64-encode the attachments passed to mc_issue_attachment_add mc_project_attachment_add and to Base64-decode the attachments retrieved with mc_issue_attachment_get and mc_project_attachment_get. Fixes #11151: Can't upload attachment to issue via soap interface ----------------------------------------------------------------------- Summary of changes: api/soap/mc_issue_attachment_api.php | 2 +- api/soap/mc_project_attachment_api.php | 2 +- tests/soap/AttachmentTest.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) ----------------------------------------------------------------------- commit dd2846611ca5b82a0dd061369eebd796857bbfa6 Author: Robert Munteanu <rob...@gm...> Date: Wed Apr 28 21:25:42 2010 +0300 Only decode attachments once when using the SOAP API Attachments uploaded using the SOAP API calls are decoded by NuSOAP. Up till now, we are also decoding the attachments, which caused the attached files to be unreadable. Although workarounds do exist, the correct way is to let NuSOAP apply the Base64-decoding. The requirement for the users of the SOAP API is to Base64-encode the attachments passed to mc_issue_attachment_add mc_project_attachment_add and to Base64-decode the attachments retrieved with mc_issue_attachment_get and mc_project_attachment_get. Fixes #11151: Can't upload attachment to issue via soap interface diff --git a/api/soap/mc_issue_attachment_api.php b/api/soap/mc_issue_attachment_api.php index c4e293e..135264e 100644 --- a/api/soap/mc_issue_attachment_api.php +++ b/api/soap/mc_issue_attachment_api.php @@ -51,7 +51,7 @@ function mc_issue_attachment_add( $p_username, $p_password, $p_issue_id, $p_name if( !access_has_bug_level( config_get( 'upload_bug_file_threshold' ), $p_issue_id, $t_user_id ) ) { return mci_soap_fault_access_denied( $t_user_id ); } - return mci_file_add( $p_issue_id, $p_name, base64_decode( $p_content ), $p_file_type, 'bug' ); + return mci_file_add( $p_issue_id, $p_name, $p_content, $p_file_type, 'bug' ); } /** diff --git a/api/soap/mc_project_attachment_api.php b/api/soap/mc_project_attachment_api.php index aa643b8..7147c1b 100644 --- a/api/soap/mc_project_attachment_api.php +++ b/api/soap/mc_project_attachment_api.php @@ -58,7 +58,7 @@ function mc_project_attachment_add( $p_username, $p_password, $p_project_id, $p_ if( is_blank( $p_title ) ) { return new soap_fault( 'Client', '', 'Title must not be empty.' ); } - return mci_file_add( $p_project_id, $p_name, base64_decode( $p_content ), $p_file_type, 'project', $p_title, $p_description ); + return mci_file_add( $p_project_id, $p_name, $p_content, $p_file_type, 'project', $p_title, $p_description ); } /** diff --git a/tests/soap/AttachmentTest.php b/tests/soap/AttachmentTest.php index 7cbd72d..a3cb726 100644 --- a/tests/soap/AttachmentTest.php +++ b/tests/soap/AttachmentTest.php @@ -72,7 +72,7 @@ class AttachmentTest extends SoapBase { $attachmentId); $this->assertEquals( 1, count( $issue->attachments ), 'count($issue->attachments)' ); - $this->assertEquals( $attachmentContents, $attachment, '$attachmentContents' ); + $this->assertEquals( $attachmentContents, base64_decode( $attachment ), '$attachmentContents' ); } @@ -124,8 +124,8 @@ class AttachmentTest extends SoapBase { $this->userName, $this->password, $attachmentId); - - $this->assertEquals( $attachmentContents, $attachment, '$attachmentContents' ); + + $this->assertEquals( $attachmentContents, base64_decode( $attachment ), '$attachmentContents' ); } /** ----------------------------------------------------------------------- -- Mantis Bug Tracker |