From f8decb037e7fac6aeb9e6b4154586bbf5a6e9c12 Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Tue, 18 Mar 2025 21:07:33 +0800 Subject: [PATCH] fix: unnecessary eval --- src/utils/url-tools.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/url-tools.ts b/src/utils/url-tools.ts index a833c18..a3f18bc 100644 --- a/src/utils/url-tools.ts +++ b/src/utils/url-tools.ts @@ -19,10 +19,14 @@ export function normalizeUrl(urlString: string, debug = false, options = { throw new Error('Empty URL'); } - if (urlString.startsWith('https://google.com') || urlString.startsWith('https://www.google.com')) { + if (urlString.startsWith('https://google.com/') || urlString.startsWith('https://www.google.com')) { throw new Error('Google search link'); } + if (urlString.includes('example.com')) { + throw new Error('Example URL'); + } + const url = new URL(urlString); if (url.protocol !== 'http:' && url.protocol !== 'https:') { throw new Error('Unsupported protocol');