mirror of
				https://github.com/mendableai/firecrawl.git
				synced 2025-11-04 03:53:17 +00: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 = 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));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user