Opened 10 years ago
Closed 9 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>— 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)
#5
@
9 years ago
This issue has been fixed on Twitter's oEmbed endpoint.
Example request:
https://api.twitter.com/1/statuses/oembed.json?url=https%3A%2F%2Ftwitter.com%2FWordPress%2Fstatus%2F596138465646940160%3Flang%3Den
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