From 1460e5715700cdb130472e1314074ff648f811d8 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 27 Sep 2022 00:29:23 +0200 Subject: [PATCH] Fix `is_url('https://ultralytics.com')` (#9610) Failing on missing path, i.e. no 'www.' Signed-off-by: Glenn Jocher Signed-off-by: Glenn Jocher --- utils/downloads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/downloads.py b/utils/downloads.py index 73b8334..60417c1 100644 --- a/utils/downloads.py +++ b/utils/downloads.py @@ -21,7 +21,7 @@ def is_url(url, check=True): try: url = str(url) result = urllib.parse.urlparse(url) - assert all([result.scheme, result.netloc, result.path]) # check if is url + assert all([result.scheme, result.netloc]) # check if is url return (urllib.request.urlopen(url).getcode() == 200) if check else True # check if exists online except (AssertionError, urllib.request.HTTPError): return False