Make WordPress Core

Ticket #24824: 24824.diff

File 24824.diff, 755 bytes (added by stevenlinx, 6 years ago)
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 2af241b..decd7d6 100644
    a b function get_attached_file( $attachment_id, $unfiltered = false ) { 
    289289        $file = get_post_meta( $attachment_id, '_wp_attached_file', true );
    290290
    291291        // If the file is relative, prepend upload dir.
    292         if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file ) && ( ( $uploads = wp_get_upload_dir() ) && false === $uploads['error'] ) ) {
    293                 $file = $uploads['basedir'] . "/$file";
     292        if ( ( $uploads = wp_get_upload_dir() ) && ! preg_match('|://|', $file) && false === $uploads['error'] ) {
     293                $file = path_join($uploads['basedir'], $file);
    294294        }
    295295
    296296        if ( $unfiltered ) {