Message info
 
To:wp-svn@lists.automattic.com From:m@wordpress.org Subject:[wp-svn] [21039] trunk/wp-admin/includes/image.php: Make sure the path exists before copying. Date:Sun, 10 Jun 2012 01:26:12 +0000 (UTC)
 

Revision
21039
Author
ryan
Date
2012-06-10 01:26:12 +0000 (Sun, 10 Jun 2012)

Log Message

Make sure the path exists before copying. see #20657

Modified Paths

Diff

Modified: trunk/wp-admin/includes/image.php (21038 => 21039)


--- trunk/wp-admin/includes/image.php	2012-06-10 00:32:52 UTC (rev 21038)
+++ trunk/wp-admin/includes/image.php	2012-06-10 01:26:12 UTC (rev 21039)
@@ -448,6 +448,11 @@
 	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 {