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