REST API: Remove trailing slashes when preloading requests and add unit tests for it.

Props antonvlasenko.
Fixes #51636.
Built from https://develop.svn.wordpress.org/trunk@51648


git-svn-id: http://core.svn.wordpress.org/trunk@51254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2021-08-20 23:44:57 +00:00
parent f514f51180
commit 7fc3aae637
2 changed files with 6 additions and 1 deletions

View File

@ -2818,6 +2818,11 @@ function rest_preload_api_request( $memo, $path ) {
} }
} }
$path = untrailingslashit( $path );
if ( empty( $path ) ) {
$path = '/';
}
$path_parts = parse_url( $path ); $path_parts = parse_url( $path );
if ( false === $path_parts ) { if ( false === $path_parts ) {
return $memo; return $memo;

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-51647'; $wp_version = '5.9-alpha-51648';
/** /**
* 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.