Correctly encode the url
parameter that gets passed to WordPress' own oEmbed endpoint URL.
Fixes #34193 Props ocean90 git-svn-id: https://develop.svn.wordpress.org/trunk@34915 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b877e3c692
commit
6705184dcc
@ -423,7 +423,7 @@ function get_oembed_endpoint_url( $permalink = '', $format = 'json' ) {
|
|||||||
|
|
||||||
if ( '' !== $permalink ) {
|
if ( '' !== $permalink ) {
|
||||||
$url = add_query_arg( array(
|
$url = add_query_arg( array(
|
||||||
'url' => $permalink,
|
'url' => urlencode( $permalink ),
|
||||||
'format' => $format,
|
'format' => $format,
|
||||||
), $url );
|
), $url );
|
||||||
}
|
}
|
||||||
@ -851,4 +851,4 @@ function print_oembed_embed_scripts() {
|
|||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -182,11 +182,11 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
|
|||||||
switch_to_blog( $child );
|
switch_to_blog( $child );
|
||||||
|
|
||||||
$post = $this->factory->post->create_and_get( array(
|
$post = $this->factory->post->create_and_get( array(
|
||||||
'post_title' => 'Hello Child Blog',
|
'post_title' => 'Hello Child Blog',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$request = array(
|
$request = array(
|
||||||
'url' => get_permalink( $post->ID ),
|
'url' => get_permalink( $post->ID ),
|
||||||
'format' => 'json',
|
'format' => 'json',
|
||||||
'maxwidth' => 600,
|
'maxwidth' => 600,
|
||||||
'callback' => '',
|
'callback' => '',
|
||||||
@ -207,11 +207,12 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
|
|||||||
$this->assertEquals( home_url() . '/?oembed=true', get_oembed_endpoint_url( '', 'json' ) );
|
$this->assertEquals( home_url() . '/?oembed=true', get_oembed_endpoint_url( '', 'json' ) );
|
||||||
$this->assertEquals( home_url() . '/?oembed=true', get_oembed_endpoint_url( '', 'xml' ) );
|
$this->assertEquals( home_url() . '/?oembed=true', get_oembed_endpoint_url( '', 'xml' ) );
|
||||||
|
|
||||||
$post_id = $this->factory->post->create();
|
$post_id = $this->factory->post->create();
|
||||||
$url = get_permalink( $post_id );
|
$url = get_permalink( $post_id );
|
||||||
|
$url_encoded = urlencode( $url );
|
||||||
|
|
||||||
$this->assertEquals( home_url() . '/?oembed=true&url=' . $url, get_oembed_endpoint_url( $url ) );
|
$this->assertEquals( home_url() . '/?oembed=true&url=' . $url_encoded, get_oembed_endpoint_url( $url ) );
|
||||||
$this->assertEquals( home_url() . '/?oembed=true&url=' . $url . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) );
|
$this->assertEquals( home_url() . '/?oembed=true&url=' . $url_encoded . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_oembed_ensure_format() {
|
function test_wp_oembed_ensure_format() {
|
||||||
|
Loading…
Reference in New Issue
Block a user