Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(youtube): Incomplete URL substring sanitization

tzhangchia17ec1c5f9a6
diff --git a/libs/components/editor-blocks/src/blocks/youtube/index.ts b/libs/components/editor-blocks/src/blocks/youtube/index.ts
index 363e7d78a9..26e4117961 100644
--- a/libs/components/editor-blocks/src/blocks/youtube/index.ts
+++ b/libs/components/editor-blocks/src/blocks/youtube/index.ts
@@ -19,7 +19,9 @@ export class YoutubeBlock extends BaseView {
const tag_name = el.tagName;
if (tag_name === 'A' && el.parentElement?.childElementCount === 1) {
const href = el.getAttribute('href');
- if (href.indexOf('.youtube.com') !== -1) {
+ const allowedHosts = ['.youtube.com'];
+
+ if (allowedHosts.includes(href)) {
return [
{
type: this.type,