From bbb8e44ac2d4f10e060012e27dea15c2f2514bb2 Mon Sep 17 00:00:00 2001 From: Victor Boctor Date: Mon, 5 Oct 2009 23:34:55 -0700 Subject: [PATCH] Fix #10776: Retrieving an attachment with the SOAP API fails due to SYSTEM NOTICE. --- api/soap/mc_file_api.php | 11 +++++++---- core/file_api.php | 4 ---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/api/soap/mc_file_api.php b/api/soap/mc_file_api.php index b40242d0eb..751b8387a0 100644 --- a/api/soap/mc_file_api.php +++ b/api/soap/mc_file_api.php @@ -160,9 +160,13 @@ function mci_file_get( $p_file_id, $p_type, $p_user_id ) { $row = db_fetch_array( $result ); $t_bug_id = $row['bug_id']; - $t_project_id = $row['project_id']; + + if ( $p_type == 'doc' ) { + $t_project_id = $row['project_id']; + } + $t_diskfile = $row['diskfile']; - $t_content = base64_encode( $row['content'] ); + $t_content = $row['content']; # Check access rights switch( $p_type ) { @@ -172,7 +176,6 @@ function mci_file_get( $p_file_id, $p_type, $p_user_id ) { } break; case 'doc': - # Check if project documentation feature is enabled. if( OFF == config_get( 'enable_project_documentation' ) ) { return new soap_fault( 'Client', '', 'Access Denied' ); @@ -201,6 +204,6 @@ function mci_file_get( $p_file_id, $p_type, $p_user_id ) { return base64_encode( mci_file_read_local( $t_diskfile ) ); } default: - return $t_content; + return base64_encode( $t_content ); } } diff --git a/core/file_api.php b/core/file_api.php index 7a0399c252..c4cf2cc9db 100644 --- a/core/file_api.php +++ b/core/file_api.php @@ -506,10 +506,6 @@ function file_delete( $p_file_id, $p_table = 'bug' ) { if( 'bug' == $p_table ) { # log file deletion history_log_event_special( $t_bug_id, FILE_DELETED, file_get_display_name( $t_filename ) ); - - if ( file_exists( $t_local_disk_file ) ) { - file_delete_local( $t_local_disk_file ); - } } $t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' );