Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32661 closed enhancement (worksforme)

oEmbed: Twitter URL pattern with query string breaks oEmbed

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


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('')
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="">June 15, 2015</a></blockquote><script async src="//" charset="utf-8"></script>"
wp> wp_oembed_get('')

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
9 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
9 years ago

Related: #32360

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

Also related: #31602.

#4 @niallkennedy
9 years ago

Verified. Thanks for the report.

#6 @netweb
9 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
9 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.