WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#32621 closed defect (bug) (worksforme)

Tumblr Embeds not Working

Reported by: chris.lewis2 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Embeds Keywords:
Focuses: Cc:

Description (last modified by dd32)

I've noticed that Tumblr embeds don't seem to be working because the response object isn't valid. According to the oembed spec we should see certain fields in the response object such as type.

Instead I'm getting 'meta' and 'response' from Tumblr's endpoint, see for example: https://www.tumblr.com/oembed/1.0?url=http%3A%2F%2Fifpaintingscouldtext.tumblr.com%2Fpost%2F119981689218%2Ffrancois-boucher-madame-de-pompadour-1756.

Change History (10)

#2 @dd32
5 years ago

  • Component changed from General to Embeds
  • Description modified (diff)

#3 follow-up: @helen
5 years ago

I think Tumblr needs to fix this to meet spec. I'm curious as to why they would have changed it to include a meta item. Do we have any contacts there?

#4 @chris.lewis2
5 years ago

This is kinda sketchy but seemed to fix the issue for me.

wp_oembed_remove_provider( '#https?://(.+)\.tumblr\.com/post/.*#i' );
wp_embed_register_handler( 'tumblr', '#https?://(.+)\.tumblr\.com/post/.*#i', function( $matches, $attr, $url, $rawattr ) {
    $wp_oembed = _wp_oembed_get_object();
    $args = '';
    $provider = 'https://www.tumblr.com/oembed/1.0';
    if( false === $data = $wp_oembed->fetch( $provider, $url, $args ) ) {
        return false;
    }
    if( property_exists( $data, 'response' ) ) {
        $data = json_decode( $data->response );
    }
    return apply_filters( 'oembed_result', $wp_oembed->data2html( $data, $url ), $url, $args );
} );

#5 @johnbillion
5 years ago

  • Version changed from 4.2.2 to 4.2

cc @elliottcarlson

#6 @elliottcarlson
5 years ago

@chris.lewis2 Thanks for the bug report. I'll have someone look in to this ASAP as nothing should have changed to break the spec or formatting of the response. Also - we should have received an automated alert on this as well. Should be fixed today.

#7 in reply to: ↑ 3 @elliottcarlson
5 years ago

Replying to helen:
You are correct - this is not supposed to have changed. It looks like someone altered the JSON response format to unify the response status - but that should not happen on this route. We will have a fix for this deployed later today.

#8 follow-up: @dmchale
5 years ago

For whatever it's worth, I just tested this on a 4.2.2 install using http://ifpaintingscouldtext.tumblr.com/post/119981689218/francois-boucher-madame-de-pompadour-1756 as the URL, and the embed worked just fine. Possibly resolved on Tumblr's end now? @elliotcarlson does that sound right?

#9 in reply to: ↑ 8 @elliottcarlson
5 years ago

Replying to dmchale:

For whatever it's worth, I just tested this on a 4.2.2 install using http://ifpaintingscouldtext.tumblr.com/post/119981689218/francois-boucher-madame-de-pompadour-1756 as the URL, and the embed worked just fine. Possibly resolved on Tumblr's end now? @elliotcarlson does that sound right?

This is correct; the cause of the issue was determined quickly this morning after being notified of this bug. The deploy that broke it occurred yesterday at 1:45pm EST, and introduced some changes in standard JSON based responses - sadly this affected the oembed endpoint unintentionally and was skipped during testing. We are taking steps to ensure that these kinds of changes won't affect things like this in the future. Thanks for the bug report, and my apologies if this caused any inconvenience!

#10 @johnbillion
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Thanks elliottcarlson!

Related: #32360

Note: See TracTickets for help on using tickets.