From 65fb28c256f13ed3682ef6e3cdae2b7097b58717 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 27 May 2026 01:31:36 -0300 Subject: [PATCH] fix: catch LocationParseError for malformed FQDNs (#2970) --- sherlock_project/sherlock.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sherlock_project/sherlock.py b/sherlock_project/sherlock.py index e037d39458..7f80d626da 100644 --- a/sherlock_project/sherlock.py +++ b/sherlock_project/sherlock.py @@ -27,6 +27,7 @@ from typing import Optional import requests +import urllib3 from requests_futures.sessions import FuturesSession from sherlock_project.__init__ import ( @@ -121,6 +122,12 @@ def get_response(request_future, error_type, social_network): if response.status_code: # Status code exists in response object error_context = None + except urllib3.exceptions.LocationParseError as errl: + error_context = "Illegal URL" + exception_text = str(errl) + except requests.exceptions.InvalidURL as erriu: + error_context = "Invalid URL" + exception_text = str(erriu) except requests.exceptions.HTTPError as errh: error_context = "HTTP Error" exception_text = str(errh)