mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
fix: url sanitization
This commit is contained in:
parent
3930f8b863
commit
1ac80e4d20
@ -24,6 +24,9 @@ export function normalizeUrl(urlString: string, debug = false, options = {
|
||||
}
|
||||
|
||||
const url = new URL(urlString);
|
||||
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
||||
throw new Error('Unsupported protocol');
|
||||
}
|
||||
|
||||
url.hostname = url.hostname.toLowerCase();
|
||||
if (url.hostname.startsWith('www.')) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user