REST API: generate a valid fallback URI in wp.api.utils.getRootURL.

When window.location.origin isn't set, correctly insert two slashes between the protocol and host when constructing the fallback URL.

props abdullahramzan.
Fixes #44764.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
K. Adam White 2018-08-11 18:51:24 +00:00
parent c0cc6617f2
commit b5ec1e6d96
3 changed files with 3 additions and 3 deletions

View File

@ -145,7 +145,7 @@
wp.api.utils.getRootUrl = function() { wp.api.utils.getRootUrl = function() {
return window.location.origin ? return window.location.origin ?
window.location.origin + '/' : window.location.origin + '/' :
window.location.protocol + '/' + window.location.host + '/'; window.location.protocol + '//' + window.location.host + '/';
}; };
/** /**

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-alpha-43565'; $wp_version = '5.0-alpha-43566';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.