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.
Merges [43566] into the 5.0 branch.
Fixes #44764.

Built from https://develop.svn.wordpress.org/branches/5.0@43757


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
danielbachhuber 2018-10-18 20:49:25 +00:00
parent 699bf044ef
commit a5bd8cb64c
3 changed files with 3 additions and 3 deletions

View File

@ -141,7 +141,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-43756'; $wp_version = '5.0-alpha-43757';
/** /**
* 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.