diff --git a/mlflow/utils/uri.py b/mlflow/utils/uri.py index eb59148cc..331648b8e 100644 --- a/mlflow/utils/uri.py +++ b/mlflow/utils/uri.py @@ -41,6 +41,10 @@ def is_local_uri(uri, is_tracking_or_registry_uri=True): return False parsed_uri = urllib.parse.urlparse(uri) + scheme = parsed_uri.scheme + if scheme == "": + return True + if parsed_uri.hostname and not ( parsed_uri.hostname == "." or parsed_uri.hostname.startswith("localhost") @@ -48,8 +52,7 @@ def is_local_uri(uri, is_tracking_or_registry_uri=True): ): return False - scheme = parsed_uri.scheme - if scheme == "" or scheme == "file": + if scheme == "file": return True if is_windows() and len(scheme) == 1 and scheme.lower() == pathlib.Path(uri).drive.lower()[0]: diff --git a/tests/utils/test_uri.py b/tests/utils/test_uri.py index 758642e9b..b776795c6 100644 --- a/tests/utils/test_uri.py +++ b/tests/utils/test_uri.py @@ -99,6 +99,8 @@ def test_is_local_uri(): assert is_local_uri("file://localhost:5000/mlruns") assert is_local_uri("file://127.0.0.1/mlruns") assert is_local_uri("file://127.0.0.1:5000/mlruns") + assert is_local_uri("//proc/self/root") + assert is_local_uri("/proc/self/root") assert not is_local_uri("file://myhostname/path/to/file") assert not is_local_uri("https://whatever")