From 9dff59ce9a9b4675baffed423bbb8a0c8bb52970 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 21 Aug 2023 13:03:09 +0200 Subject: [PATCH 1/2] fix(link): allow all non-whitesapce chars in urls --- src/utils/item.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/item.ts b/src/utils/item.ts index a13e18572..207ad7d32 100644 --- a/src/utils/item.ts +++ b/src/utils/item.ts @@ -87,7 +87,7 @@ export const isUrlValid = (str?: string | null): boolean => { '((\\d{1,3}\\.){3}\\d{1,3})|' + // OR ip (v4) address 'localhost)' + // OR localhost alias '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path - '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string + '(\\?\\S*)?' + // query string '(\\#\\S*)?$', // fragment locator 'i', ); From 1af3d0fb02ba20afa757a054d165bdd40ad090f4 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 21 Aug 2023 13:27:26 +0200 Subject: [PATCH 2/2] fix: make it even more generic --- src/utils/item.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/item.ts b/src/utils/item.ts index 207ad7d32..f2b663892 100644 --- a/src/utils/item.ts +++ b/src/utils/item.ts @@ -86,8 +86,9 @@ export const isUrlValid = (str?: string | null): boolean => { '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name '((\\d{1,3}\\.){3}\\d{1,3})|' + // OR ip (v4) address 'localhost)' + // OR localhost alias - '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path - '(\\?\\S*)?' + // query string + '(\\:\\d+)?' + // post (optional) + '(\\/\\S*?)*' + // path (lazy: takes as few as possible) + '(\\?\\S*?)?' + // query string (lazy) '(\\#\\S*)?$', // fragment locator 'i', );