Skip to content

Commit

Permalink
Set bug attachment ownership when copying them
Browse files Browse the repository at this point in the history
file_copy_attachments() did not set user_id when inserting the new
attachment, resulting in that field being set to 0.

The user_id is now set to the original issue's.

Fixes #20018
  • Loading branch information
dregad committed Aug 13, 2015
1 parent 1ca48c1 commit 59b66a2
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions core/file_api.php
Expand Up @@ -1054,19 +1054,22 @@ function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) {
}
}

$t_query = 'INSERT INTO {bug_file}
( bug_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content )
VALUES ( ' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ',
' . db_param() . ');';
db_query( $t_query, array( $p_dest_bug_id, $t_bug_file['title'], $t_bug_file['description'], $t_new_diskfile_name, $t_new_file_name, $t_file_path, $t_bug_file['filesize'], $t_bug_file['file_type'], $t_bug_file['date_added'], $t_bug_file['content'] ) );
$t_query = 'INSERT INTO {bug_file} (
bug_id, title, description, diskfile, filename, folder,
filesize, file_type, date_added, user_id, content
)
VALUES ( '
. db_param() . ', ' . db_param() . ', ' . db_param() . ', '
. db_param() . ', ' . db_param() . ', ' . db_param() . ', '
. db_param() . ', ' . db_param() . ', ' . db_param() . ', '
. db_param() . ', ' . db_param() .
')';
db_query( $t_query, array(
$p_dest_bug_id, $t_bug_file['title'], $t_bug_file['description'],
$t_new_diskfile_name, $t_new_file_name, $t_file_path,
$t_bug_file['filesize'], $t_bug_file['file_type'], $t_bug_file['date_added'],
$t_bug_file['user_id'], $t_bug_file['content']
) );
}
}

Expand Down

0 comments on commit 59b66a2

Please sign in to comment.