mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 11:42:24 +08:00
fix(v1/map): handle invalid URLs gracefully
This commit is contained in:
parent
e19f7a102e
commit
ad1a6fbc74
|
@ -88,7 +88,13 @@ export async function mapController(
|
||||||
links = performCosineSimilarity(links, searchQuery);
|
links = performCosineSimilarity(links, searchQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
links = links.map((x) => checkAndUpdateURLForMap(x).url.trim());
|
links = links.map((x) => {
|
||||||
|
try {
|
||||||
|
return checkAndUpdateURLForMap(x).url.trim()
|
||||||
|
} catch (_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}).filter(x => x !== null);
|
||||||
|
|
||||||
// allows for subdomains to be included
|
// allows for subdomains to be included
|
||||||
links = links.filter((x) => isSameDomain(x, req.body.url));
|
links = links.filter((x) => isSameDomain(x, req.body.url));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user