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

Props antonvlasenko.
Fixes #51636.

git-svn-id: https://develop.svn.wordpress.org/trunk@51648 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2021-08-20 23:43:21 +00:00
parent 40506e7e64
commit fe3d953437
2 changed files with 30 additions and 0 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 );
if ( false === $path_parts ) {
return $memo;