fix(v1/map): handle invalid URLs gracefully

This commit is contained in:
Gergő Móricz 2024-09-10 19:41:01 +02:00
parent e19f7a102e
commit ad1a6fbc74

View File

@ -88,7 +88,13 @@ export async function mapController(
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
links = links.filter((x) => isSameDomain(x, req.body.url));