Skip to content

Commit

Permalink
Fixes #9905: Simplify the process of moving the attachments folder --…
Browse files Browse the repository at this point in the history
…- handle existing attachments with full path.
  • Loading branch information
Victor Boctor committed Nov 27, 2008
1 parent e0d3b36 commit 55e3c60
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/file_api.php
Expand Up @@ -197,12 +197,14 @@ function file_normalize_attachment_path( $p_diskfile, $p_project_id ) {
if ( file_exists( $p_diskfile ) ) {
return $p_diskfile;
}

$t_basename = basename( $p_diskfile );

$t_expected_file_path = '';

$t_path = project_get_field( $p_project_id, 'file_path' );
if ( !is_blank( $t_path ) ) {
$t_diskfile = file_path_combine( $t_path, $p_diskfile );
$t_diskfile = file_path_combine( $t_path, $t_basename );

if ( file_exists( $t_diskfile ) ) {
return $t_diskfile;
Expand All @@ -214,7 +216,7 @@ function file_normalize_attachment_path( $p_diskfile, $p_project_id ) {

$t_path = config_get( 'absolute_path_default_upload_folder' );
if ( !is_blank( $t_path ) ) {
$t_diskfile = file_path_combine( $t_path, $p_diskfile );
$t_diskfile = file_path_combine( $t_path, $t_basename );

if ( file_exists( $t_diskfile ) ) {
return $t_diskfile;
Expand Down

0 comments on commit 55e3c60

Please sign in to comment.