Permalink
Browse files

Make sure the path exists before copying. see #20657

git-svn-id: http://core.svn.wordpress.org/trunk@21039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
ryan
ryan committed Jun 10, 2012
1 parent 4e735c5 commit bce8cd343a104c2d0bc9117121fcb35942366a62
Showing with 5 additions and 0 deletions.
  1. +5 −0 wp-admin/includes/image.php
@@ -448,6 +448,11 @@ function _copy_image_file( $attachment_id ) {
if ( $src_file ) {
$dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
+
+ // The directory containing the original file may no longer exist when
+ // using a replication plugin.
+ wp_mkdir_p( dirname( $dst_file ) );
+
if ( ! @copy( $src_file, $dst_file ) )
$dst_file = false;
} else {

0 comments on commit bce8cd3

Please sign in to comment.