Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54789 closed defect (bug) (reported-upstream)

oEmbeds: allow embedding Twitter Profiles with a trailing slash

Reported by: jeherve's profile jeherve Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Embeds Keywords:
Focuses: Cc:

Description

This is a follow-up to #38003.

#### Steps to reproduce

  1. Go to Posts > Add New
  2. On a new line, paste a Twitter profile URL, without a trailing slash, such as https://twitter.com/jeherve
  3. The URL will be transformed into an embed block (Twitter variation).
  4. Now, paste a Twitter profile URL with a trailing slash, e.g. https://twitter.com/wordpress/
  5. You'll notice that the embed fails for this URL.

This appears to be because we do not currently support trailing slashes for profile URLs:

'#https?://(www\.)?twitter\.com/\w{1,15}$#i' => array( 'https://publish.twitter.com/oembed', true ),
-- https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-oembed.php#L68

It seems that this was done on purpose when those regexes were added:

Turns out that Twitter's API doesn't like trailing slashes so I'm going to remove the optional slash from the regex.

-- https://core.trac.wordpress.org/ticket/38003#comment:9

Would it be possible to add the trailing slash today, or is this still an issue?

Attachments (1)

54789.diff (1.1 KB) - added by jeherve 3 years ago.
Allow trailing slash in Twitter Profile embeds

Download all attachments as: .zip

Change History (4)

@jeherve
3 years ago

Allow trailing slash in Twitter Profile embeds

#1 @skithund
3 years ago

It's still an issue. Twitter API doesn't like the trailing slash.

https://publish.twitter.com/oembed?url=https://twitter.com/TwitterDev/

#2 @jeherve
3 years ago

  • Resolution set to reported-upstream
  • Status changed from new to closed

Ah, I missed that in my test. Good call. Closing this then. 👍

I've reported the issue to Twitter here:

#3 @desrosj
3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.