Skip to content

Add Twitter pattern without subdomains #362

@rsanzante

Description

@rsanzante

I have a strange issue. I'm using Embed URL, a Drupal module that requires another Drupal module, Embed, that uses this library.

The URL Embed module is supposed to allow embedding content using oEmbed. It works ok with several providers but not for Twitter's tweets. After a debugging sessions, it seems the URL is not detected properly because Embed\Providers\OEmbed\Twitter::getPatterns() returns just 'https?://*.twitter.com/*'. This pattern doesn't match the standard tweet URL like https://twitter.com/USER/status/TWEET_ID.

The module works if I add a new pattern: 'https?://twitter.com/*'.

However, if you go to the test URL (https://oscarotero.com/embed/demo/index.php) and type a tweet URL it seems to work. For example:

https://oscarotero.com/embed/demo/index.php?url=https%3A%2F%2Ftwitter.com%2Fmetadrop%2Fstatus%2F1267734586525659138

This is the tweet I was having problems to display.

So, I don't understand what is happening. It seems tweets should not be displayed because match fails, as it happening in my Durpal installation, but the test URL indeed shows the tweet. If I 'fix' the patterns, the Drupal module works ok. I'm crating a PR, but I'm not really sure If this a proper fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions