Skip to content

Twitter embed fails with trailing slash on URL #12664

Closed

Description

@kriskarkoski

Describe the bug
Attempting to embed a Tweet with a URL containing a trailing slash causes the embed to fail. While Twitter seems to default to no-slash it does not redirect a URL with a trailing slash to the no-slash version.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'wp-admin/post-new.php'
  2. Paste a Twitter single-Tweet URL with a trailing slash on its own or in the embed or Twitter blocks
  3. See embed error and URL displays on the front-end instead of embed

Expected behavior
The Tweet to embed the same as with no trailing slash

Screenshots
screen shot 2018-12-06 at 7 43 55 pm

Desktop (please complete the following information):

  • OS: OS X 10
  • Chrome
  • Version 70.0.3538.11

Additional context

  • WordPress 5.0. No plugins.

Activity

  1. added
    [Type] Bug
    [Block] Embed
    Good First Issue
    on Dec 7, 2018
  2. danielbachhuber commented on Dec 7, 2018

    @danielbachhuber
    Member

    Thanks for the report, @kriskarkoski. This should be relatively straightforward to fix up. I've filed it against WordPress 5.0.x Follow Ups

  3. added
    [Status] In Progress
    on Dec 9, 2018
  4. removed
    [Status] In Progress
    on Feb 7, 2019
  5. gziolo commented on Feb 7, 2019

    @gziolo
    Member

    Initial exploration was executed by @alpinealex in #12739. It wasn't finished and this issue can be taken over by someone else. This is the latest recommendation from @notnownikki how to fix this bug:

    I'd rather this removed the trailing slash if the embed failed, just so we can support embed URLs that do end with a trailing slash. That should be easy enough to do in componentDidUpdate (of edit component).

  6. gbroques commented on Mar 24, 2019

    @gbroques

    @gziolo I can take this over.

  7. gziolo commented on Mar 24, 2019

    @gziolo
    Member

    @gbroques, thank you 👍

  8. gbroques commented on Mar 24, 2019

    @gbroques

    @gziolo I believe I fixed the issue as @notnownikki suggested and put up a PR #14600.

    However, I can't seem to run the e2e tests locally to fix the test that's failing the build.

    Error: The constant 'SCRIPT_DEBUG' is not defined in the 'wp-config.php' file.

    I'm using the built-in local environment as suggested by the End to end testing section in the docs.


    OS: Ubuntu 16.04
    Docker version: 18.09.3, build 774a1f4
    Docker Compose version: 1.22.0, build f46880fe
    Node version: v10.15.3

  9. notnownikki commented on Mar 24, 2019

    @notnownikki
    Member
  10. added a commit that references this issue on Mar 28, 2019
    9f0f0ce
  11. gbroques commented on Mar 29, 2019

    @gbroques

    Another contributor can pick this issue up and use my PR #14600 as a starting place.

    It looks like all that's needed is a fix to the e2e tests. Read the PR comments for @notnownikki's suggestion.

    Hope this helps! :)

  12. added a commit that references this issue on Mar 29, 2019
    aea4cef
  13. added a commit that references this issue on Mar 29, 2019
    fd72892
  14. added 2 commits that reference this issue on Apr 3, 2019
    96ea2a2
    09ac4a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First Issue[Block] Embed[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions