From 47bc6638403d096afbf52f3d1b366d184f313d71 Mon Sep 17 00:00:00 2001 From: Akshat Sinha Date: Sun, 14 Dec 2025 22:35:02 +0530 Subject: [PATCH] Bugfix(uri test): Fixed is_uri to correctly reject strings without a URI scheme. --- lib/ansible/plugins/test/uri.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/test/uri.py b/lib/ansible/plugins/test/uri.py index 8273801c03f..e8f7dcb22ef 100644 --- a/lib/ansible/plugins/test/uri.py +++ b/lib/ansible/plugins/test/uri.py @@ -9,7 +9,8 @@ def is_uri(value, schemes=None): """ Will verify that the string passed is a valid 'URI', if given a list of valid schemes it will match those """ try: x = urlparse(value) - isit = all([x.scheme is not None, x.path is not None, not schemes or x.scheme in schemes]) + # urlparse returns empty string for scheme when not present, not None + isit = all([x.scheme, x.path is not None, not schemes or x.scheme in schemes]) except Exception as e: isit = False return isit