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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(editor): prevent errors from isStrictUrl (#9419)
Saul-Mirone6b1865ff920c
diff --git a/blocksuite/affine/shared/src/utils/url.ts b/blocksuite/affine/shared/src/utils/url.tsindex d00830716a..6a24ef5392 100644--- a/blocksuite/affine/shared/src/utils/url.ts+++ b/blocksuite/affine/shared/src/utils/url.ts@@ -130,14 +130,17 @@ function isCommonTLD(url: URL) {* Assuming the user will input anything, we need to check rigorously.*/export function isStrictUrl(str: string) {- if (!isValidUrl(str)) {+ try {+ if (!isValidUrl(str)) {+ return false;+ }++ const url = new URL(normalizeUrl(str));++ return isCommonTLD(url);+ } catch {return false;}- const url = new URL(normalizeUrl(str));- if (isCommonTLD(url)) {- return true;- }- return false;}export function isUrlInClipboard(clipboardData: DataTransfer) {