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

[BUG]: Youtube Extension: pasting "https://youtube.com" is considered a valid youtube link #4560

Closed
1 of 2 tasks
hadielyakhni opened this issue Oct 24, 2023 · 0 comments · Fixed by #4645
Closed
1 of 2 tasks
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@hadielyakhni
Copy link
Contributor

hadielyakhni commented Oct 24, 2023

Which packages did you experience the bug in?

@tiptap/extension-youtube

What Tiptap version are you using?

2.1.12

What’s the bug you are facing?

We are using the YouTube extension in our React application.

When pasting the string https://youtube.com, it will be matched by the paste rule, however, when rendering the iframe, getEmbedUrlFromYoutubeUrl returns null since the string https://youtube.com does not contain a proper src, hence the iframe is rendered without a src attribute, aka as an empty iframe. Please note that till this point, nothing crashes, it's just an empty iframe.

However, this behavior will cause a crash in our application because we persist the content, so when the user refreshes the browser, parseHtml will not be able to find the src attribute, hence, renderHtml will pass null to getEmbedUrlFromYoutubeUrl, crashing the browser with the following error: "cannot read property of null".

What browser are you using?

Chrome

Code example

https://codesandbox.io/s/reverent-star-ps5wc8?file=/src/App.js

What did you expect to happen?

YOUTUBE_REGEX_GLOBAL not matching the string https://youtube.com

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@hadielyakhni hadielyakhni added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Oct 24, 2023
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Oct 24, 2023
@hadielyakhni hadielyakhni changed the title Youtube Extension: pasting "https://youtube.com" is considered a valid youtube link [BUG]: Youtube Extension: pasting "https://youtube.com" is considered a valid youtube link Oct 24, 2023
C-Hess added a commit to C-Hess/tiptap that referenced this issue Oct 30, 2023
@github-project-automation github-project-automation bot moved this from Triage open to Done in Tiptap Nov 20, 2023
@janthurau janthurau reopened this Nov 20, 2023
bdbch added a commit that referenced this issue Dec 5, 2024
#4645)

* replaced youtube regex with regex found on https://regexr.com/3dj5t, fixes #4560

* adds support for music. subdomain

* Create dry-ghosts-wash.md

---------

Co-authored-by: bdbch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Archived in project
4 participants