mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
fix: unnecessary eval
This commit is contained in:
parent
1f248de100
commit
f8decb037e
@ -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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user