Recognize windows absolute paths. see #7904
git-svn-id: https://develop.svn.wordpress.org/trunk@9242 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
930876240f
commit
a612119693
|
@ -28,9 +28,8 @@
|
||||||
function get_attached_file( $attachment_id, $unfiltered = false ) {
|
function get_attached_file( $attachment_id, $unfiltered = false ) {
|
||||||
$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
|
$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
|
||||||
// If the file is relative, prepend upload dir
|
// 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";
|
$file = $uploads['basedir'] . "/$file";
|
||||||
|
|
||||||
if ( $unfiltered )
|
if ( $unfiltered )
|
||||||
return $file;
|
return $file;
|
||||||
return apply_filters( 'get_attached_file', $file, $attachment_id );
|
return apply_filters( 'get_attached_file', $file, $attachment_id );
|
||||||
|
|
Loading…
Reference in New Issue