Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#39179 closed defect (bug) (invalid)

Media has incorrect File URL on site with alternate uploads folder

Reported by: oxfordian3's profile oxfordian3 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Media Keywords:
Focuses: Cc:

Description

Migrated from 4.6.1 to 4.7 and found new issue with Media Upload.

On this particular site, the default upload folder is customized with UPLOADS defined at the end of wp-config.php:

<?php
require_once(ABSPATH . 'wp-settings.php');
define('UPLOADS', 'files');

When doing a standard upload of an image file, the resulting File URL should be as follows (which worked in 4.6.1):

http://DOMAIN/files/[IMG-FILE]

but after 4.7 upgrade, results in:

http://DOMAIN/wp-content/uploads/[FULL-LOCAL-PATH-TO-SITE-ROOT]/files/[IMG-FILE]

i.e the File URL contains LOCAL-PATH from root ("/nfs/c12/h07/mnt/ etc.")

Full disclosure: this occurred when I migrated the site to a new host, and at the same time upgraded from 4.6.1 to 4.7.

Change History (3)

#1 follow-up: @dd32
7 years ago

Hi @oxfordian3 and welcome to Trac

Do you experience the same scenario when define('UPLOADS', 'files'); is placed before require_once(ABSPATH . 'wp-settings.php');? Defining it after isn't supposed to be supported (AFAIK).

#2 in reply to: ↑ 1 @oxfordian3
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Replying to dd32:

Hi @oxfordian3 and welcome to Trac

Do you experience the same scenario when define('UPLOADS', 'files'); is placed before require_once(ABSPATH . 'wp-settings.php');? Defining it after isn't supposed to be supported (AFAIK).

Hi @dd32

I moved define('UPLOADS', 'files'); to before require_once(ABSPATH . 'wp-settings.php'); and that fixed it. The Media Library shows File URL in the right place, and missing thumbnails are now displaying correctly.

Can mark ticket as resolved. Thanks!

#3 @swissspidy
7 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.