Recognize windows absolute paths. see #7904

git-svn-id: http://svn.automattic.com/wordpress/trunk@9242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-10-18 19:48:49 +00:00
parent a8f998d914
commit 782e278c72
1 changed files with 1 additions and 2 deletions

View File

@ -28,9 +28,8 @@
function get_attached_file( $attachment_id, $unfiltered = false ) {
$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
// If the file is relative, prepend upload dir
if ( 0 !== strpos($file, '/') && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
if ( 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
$file = $uploads['basedir'] . "/$file";
if ( $unfiltered )
return $file;
return apply_filters( 'get_attached_file', $file, $attachment_id );