When determining a frontend, local URL in the theme customizer, match the home URL without a trailing slash.

props SergeyBiryukov.
fixes #25315.

Built from https://develop.svn.wordpress.org/trunk@25681


git-svn-id: http://core.svn.wordpress.org/trunk@25597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-03 01:50:09 +00:00
parent 70a406560e
commit aef18d93cb
2 changed files with 8 additions and 3 deletions

View File

@ -553,14 +553,19 @@
// Check for URLs that include "/wp-admin/" or end in "/wp-admin". // Check for URLs that include "/wp-admin/" or end in "/wp-admin".
// Strip hashes and query strings before testing. // Strip hashes and query strings before testing.
if ( /\/wp-admin(\/|$)/.test( to.replace(/[#?].*$/, '') ) ) if ( /\/wp-admin(\/|$)/.test( to.replace( /[#?].*$/, '' ) ) )
return null; return null;
// Attempt to match the URL to the control frame's scheme // Attempt to match the URL to the control frame's scheme
// and check if it's allowed. If not, try the original URL. // and check if it's allowed. If not, try the original URL.
$.each([ to.replace( rscheme, self.scheme() ), to ], function( i, url ) { $.each([ to.replace( rscheme, self.scheme() ), to ], function( i, url ) {
$.each( self.allowedUrls, function( i, allowed ) { $.each( self.allowedUrls, function( i, allowed ) {
if ( 0 === url.indexOf( allowed ) ) { var path;
allowed = allowed.replace( /\/+$/, '' );
path = url.replace( allowed, '' );
if ( 0 === url.indexOf( allowed ) && /^([/#?]|$)/.test( path ) ) {
result = url; result = url;
return false; return false;
} }

File diff suppressed because one or more lines are too long