Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeds: pasting a non-embeddable Facebook URL throws a TypeError #25108

Closed
jsnajdr opened this issue Sep 7, 2020 · 5 comments · Fixed by #25140
Closed

Embeds: pasting a non-embeddable Facebook URL throws a TypeError #25108

jsnajdr opened this issue Sep 7, 2020 · 5 comments · Fixed by #25140
Assignees
Labels
[Block] Embed Affects the Embed Block [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@jsnajdr
Copy link
Member

jsnajdr commented Sep 7, 2020

To reproduce
Start editing a post and paste the following URL:

https://www.facebook.com/informationisbeautiful/

It's a link to a Facebook page that is not embeddable. The oEmbed Proxy REST request returns a response with html: false:

Screenshot 2020-09-07 at 12 24 50

This then leads to an error being reported in console:

Screenshot 2020-09-07 at 12 28 38

The offending function is isFromWordPress that calls html.includes() on its html argument that is false.

The embed block UI then ends up like this:

Screenshot 2020-09-07 at 12 24 59

Expected behavior
When testing on WordPress.com or on a self-hosted WordPress 5.4.2 with default editor, I see something more correct:

Screenshot 2020-09-07 at 12 13 04

The fact that this works correctly with older versions of Gutenberg that are not bleeding edge suggests the bug is a recent regression. Maybe the refactoring in #24090 by @ntsekouras is the cause?

Editor version (please complete the following information):

  • WordPress version: 5.5.1
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? Gutenberg plugin
  • If the Gutenberg plugin is installed, which version is it? built from master
@jsnajdr jsnajdr added [Type] Regression Related to a regression in the latest release [Block] Embed Affects the Embed Block labels Sep 7, 2020
@ntsekouras
Copy link
Contributor

ntsekouras commented Sep 7, 2020

Hey @jsnajdr thanks for reporting this. This seems to need a bit more investigation but maybe the removal of support for facebook embeds here: #24472 might be involved.

Also just pasting your provided url in creates a code block for me.. Do you try to insert an embed block and paste the url?

@jsnajdr
Copy link
Member Author

jsnajdr commented Sep 7, 2020

Also just pasting your provided url in creates a code block for me..

I'm simply copy&pasting a URL from the browser URL bar. The code block is triggered by the triple-backtick Markdown formatting I used to write the URL in the issue description. Maybe you're doing some rich-text copy&paste that copies the formatting, too? That looks like a plausible way how the code block could be triggered.

@ntsekouras
Copy link
Contributor

The code block is triggered by the triple-backtick Markdown formatting

Yes that was the case 👍, my bad, but it's the same as trying to create an embed block due to the embed block's transformations.

@jsnajdr
Copy link
Member Author

jsnajdr commented Sep 8, 2020

@ntsekouras It seems to be caused by #24090 after all, namely the refactor that replaced Lodash includes( html, x ) with html.includes( x ). See the fix in #25140.

@ntsekouras
Copy link
Contributor

Thanks @jsnajdr for looking into it and for the fix! I approved your fix there 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Embed Affects the Embed Block [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants