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

tzhangchi88645938822b
diff --git a/libs/components/editor-blocks/src/components/source-view/format-url/youtube.ts b/libs/components/editor-blocks/src/components/source-view/format-url/youtube.ts
index ebc0c70be0..202f0dc968 100644
--- a/libs/components/editor-blocks/src/components/source-view/format-url/youtube.ts
+++ b/libs/components/editor-blocks/src/components/source-view/format-url/youtube.ts
@@ -1,5 +1,6 @@
export const isYoutubeUrl = (url?: string): boolean => {
- return url.includes('youtu.be') || url.includes('youtube.com');
+ const allowedHosts = ['youtu.be', 'youtube.com'];
+ return allowedHosts.includes(url);
};
const _regexp = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#&?]*).*/;
diff --git "a/\357\274\201" "b/\357\274\201"
new file mode 100644
index 0000000000..e69de29bb2