Skip to content

Commit

Permalink
Fixed #8492: Add attachment succeeds but creates broken attachment if…
Browse files Browse the repository at this point in the history
… upload path not found.

Fixed #8493: Attachments created via SOAP API don't owner attachments_file_permissions config option.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/branches/BRANCH_1_1_0@4654 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Oct 20, 2007
1 parent 02a2036 commit 2a5344d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions api/soap/mc_file_api.php
Expand Up @@ -7,7 +7,7 @@
# See docs/ folder for more details

# --------------------------------------------------------
# $Id: mc_file_api.php,v 1.1 2007-07-18 06:52:53 vboctor Exp $
# $Id: mc_file_api.php,v 1.1.2.1 2007-10-20 23:17:43 vboctor Exp $
# --------------------------------------------------------

# --------------------
Expand Down Expand Up @@ -78,6 +78,11 @@ function mci_file_add( $p_id, $p_name, $p_content, $p_file_type, $p_table, $p_ti
$t_file_path = config_get( 'absolute_path_default_upload_folder' );
}
}

if ( !file_exists( $t_file_path ) ) {
return new soap_fault( 'Server', '', "Upload folder '{$t_file_path}' doesn't exist." );
}

$c_file_path = db_prepare_string( $t_file_path );
$c_new_file_name = db_prepare_string( $p_name );

Expand All @@ -101,9 +106,10 @@ function mci_file_add( $p_id, $p_name, $p_content, $p_file_type, $p_table, $p_ti
file_ftp_put ( $conn_id, $t_disk_file_name, $t_disk_file_name );
file_ftp_disconnect ( $conn_id );
file_delete_local( $p_disk_file_name );
} else {
chmod( $t_disk_file_name, 0400 );
}

chmod( $t_disk_file_name, config_get( 'attachments_file_permissions' ) );

$c_content = '';
}
break;
Expand Down

0 comments on commit 2a5344d

Please sign in to comment.