Gutenberg: Twitter embed fails with trailing slash on URL

Created on 7 Dec 2018  ·  7Comments  ·  Source: WordPress/gutenberg

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.
Good First Issue [Block] Embed [Type] Bug

All 7 comments

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

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).

@gziolo I can take this over.

@gbroques, thank you 👍

@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

Hey folks, I can take a look at this fix tomorrow. If you're having trouble
getting e2e tests to run or pass locally, I'm happy to help out there 🙂

On Sun, 24 Mar 2019, 17:19 G Roques, notifications@github.com wrote:

@gziolo https://github.com/gziolo I believe I fixed the issue as
@notnownikki https://github.com/notnownikki suggested, but ran into
some issues running the e2e tests locally.

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

I'm using the built-in local environment
https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md#local-environment
as suggested by the End to end testing
https://github.com/WordPress/gutenberg/blob/master/docs/contributors/testing-overview.md#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


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/WordPress/gutenberg/issues/12664#issuecomment-475979958,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADKSsiFx_gz4uhUhC-gXJ7Tsu9YRyBq6ks5vZ7OXgaJpZM4ZHlda
.

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! :)

Was this page helpful?
0 / 5 - 0 ratings