Skip to content

Commit 46960e0

Browse files
committedOct 18, 2011
Fix #8504: Use is_blank() not '' to check empty path in file_add()
1 parent 12cf79d commit 46960e0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
 

‎core/file_api.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ function file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc
668668
$t_file_path = config_get( 'absolute_path_default_upload_folder' );
669669
} else {
670670
$t_file_path = project_get_field( $t_project_id, 'file_path' );
671-
if( $t_file_path == '' ) {
671+
if( is_blank( $t_file_path ) ) {
672672
$t_file_path = config_get( 'absolute_path_default_upload_folder' );
673673
}
674674
}
@@ -1019,26 +1019,26 @@ function file_move_bug_attachments( $p_bug_id, $p_project_id_to ) {
10191019
}
10201020

10211021
/**
1022-
*
1022+
*
10231023
* Copies all attachments from the source bug to the destination bug
1024-
*
1024+
*
10251025
* <p>Does not perform history logging and does not perform access checks.</p>
1026-
*
1026+
*
10271027
* @param int $p_source_bug_id
10281028
* @param int $p_dest_bug_id
10291029
*/
10301030
function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) {
1031-
1031+
10321032
$t_mantis_bug_file_table = db_get_table( 'bug_file' );
1033-
1033+
10341034
$query = 'SELECT * FROM ' . $t_mantis_bug_file_table . ' WHERE bug_id = ' . db_param();
10351035
$result = db_query_bound( $query, Array( $p_source_bug_id ) );
10361036
$t_count = db_num_rows( $result );
1037-
1037+
10381038
$t_bug_file = array();
10391039
for( $i = 0;$i < $t_count;$i++ ) {
10401040
$t_bug_file = db_fetch_array( $result );
1041-
1041+
10421042
# prepare the new diskfile name and then copy the file
10431043
$t_file_path = dirname( $t_bug_file['folder'] );
10441044
$t_new_diskfile_name = $t_file_path . file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path );
@@ -1047,7 +1047,7 @@ function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) {
10471047
copy( $t_bug_file['diskfile'], $t_new_diskfile_name );
10481048
chmod( $t_new_diskfile_name, config_get( 'attachments_file_permissions' ) );
10491049
}
1050-
1050+
10511051
$query = "INSERT INTO $t_mantis_bug_file_table
10521052
( bug_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content )
10531053
VALUES ( " . db_param() . ",

0 commit comments

Comments
 (0)
Please sign in to comment.