Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #10776: Retrieving an attachment with the SOAP API fails due to S…
…YSTEM NOTICE.
  • Loading branch information
vboctor committed Oct 6, 2009
1 parent 02abb19 commit 00f35a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 7 additions & 4 deletions api/soap/mc_file_api.php
Expand Up @@ -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 ) {
Expand All @@ -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' );
Expand Down Expand Up @@ -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 );
}
}
4 changes: 0 additions & 4 deletions core/file_api.php
Expand Up @@ -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( $p_table . '_file' );
Expand Down

0 comments on commit 00f35a4

Please sign in to comment.