WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#32661 closed enhancement (worksforme)

oEmbed: Twitter URL pattern with query string breaks oEmbed

Reported by: davisshaver Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Embeds Keywords:
Focuses: ui, administration Cc:

Description

When query strings that may have been appended to a tweet are URL encoded, the resulting extra characters in the URL parameter cause the oEmbed call to fail.

This wp shell output is a good demonstration of the problem.

wp> wp_oembed_get('https://twitter.com/mkramer/status/610467064000581633')
string(339) "<blockquote class="twitter-tweet" width="474"><p lang="en" dir="ltr">Just found out about another digital NPR person leaving.</p>&mdash; Melody Joy Kramer (@mkramer) <a href="https://twitter.com/mkramer/status/610467064000581633">June 15, 2015</a></blockquote><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>"
wp> wp_oembed_get('https://twitter.com/mkramer/status/610467064000581633?s=2')
bool(false)

The expected user behavior of that second URL would be that it too transforms into the embedded tweet.

The addition of a oembed_fetch_url_pre at the beginning of the fetch() function would allow us to filter the URL before it is encoded and appended to the provider URL. This filter would prevent us from having to manually recreate the oEmbed/provider URL in oembed_fetch_url.

Change History (7)

#1 @nacin
6 years ago

This appears to be an issue with Twitter's endpoint. As they are using these query strings in some places (I see it when I share a tweet from Twitter for Android), they should definitely fix it. :-) cc @niallkennedy

#2 follow-up: @johnbillion
6 years ago

Related: #32360

#3 in reply to: ↑ 2 @davisshaver
6 years ago

Also related: #31602.

#4 @niallkennedy
6 years ago

Verified. Thanks for the report.

#6 @netweb
6 years ago

  • Keywords close added

Apart from adding unit tests for this in #32360 I don't think anything else is needed here, is there?

#7 @johnbillion
6 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.