A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: fix crash in crawler on invalid URL in matchesNoProxy
Mohamed Bassemd0f71a4c9e8e
diff --git a/apps/workers/network.ts b/apps/workers/network.tsindex acfd2439..d1cda62c 100644--- a/apps/workers/network.ts+++ b/apps/workers/network.ts@@ -7,6 +7,7 @@ import { LRUCache } from "lru-cache";import fetch, { Headers } from "node-fetch";import serverConfig from "@karakeep/shared/config";+import logger from "@karakeep/shared/logger";const DISALLOWED_IP_RANGES = new Set([// IPv4 ranges@@ -212,9 +213,14 @@ export function getRandomProxy(proxyList: string[]): string {}export function matchesNoProxy(url: string, noProxy: string[]) {- const urlObj = new URL(url);- const hostname = urlObj.hostname;- return hostnameMatchesAnyPattern(hostname, noProxy);+ try {+ const urlObj = new URL(url);+ const hostname = urlObj.hostname;+ return hostnameMatchesAnyPattern(hostname, noProxy);+ } catch (e) {+ logger.error(`Failed to parse URL: ${url}: ${e}`);+ return false;+ }}export function getProxyAgent(url: string) {