WordPress.org

Make WordPress Core

Ticket #36308: 36308.2.diff

File 36308.2.diff, 723 bytes (added by stevenlinx, 2 years ago)
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 56c2ea5..22bab8d 100644
    a b function get_attached_file( $attachment_id, $unfiltered = false ) { 
    274274        $file = get_post_meta( $attachment_id, '_wp_attached_file', true );
    275275
    276276        // If the file is relative, prepend upload dir.
    277         if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file ) && ( ( $uploads = wp_get_upload_dir() ) && false === $uploads['error'] ) ) {
    278                 $file = $uploads['basedir'] . "/$file";
     277        if ( ( $uploads = wp_get_upload_dir() ) && false === $uploads['error'] ) {
     278                $file = path_join($uploads['basedir'], $file);
    279279        }
    280280
    281281        if ( $unfiltered ) {