From 115bc903299137116cbf32e51a36858d6b5bc3f2 Mon Sep 17 00:00:00 2001 From: Nokul Debanath Date: Tue, 17 Mar 2026 09:30:37 +0200 Subject: [PATCH] Enhance URI scheme validation for Windows paths --- pyiceberg/io/pyarrow.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyiceberg/io/pyarrow.py b/pyiceberg/io/pyarrow.py index 8f22261f5d..5e9a350d46 100644 --- a/pyiceberg/io/pyarrow.py +++ b/pyiceberg/io/pyarrow.py @@ -397,7 +397,8 @@ def parse_location(location: str, properties: Properties = EMPTY_DICT) -> tuple[ """ uri = urlparse(location) - if not uri.scheme: + if not uri.scheme or (len(uri.scheme) == 1 and uri.scheme.isalpha()): + # len == 1 and alpha catches Windows drive letters like C:\ D:\ default_scheme = properties.get("DEFAULT_SCHEME", "file") default_netloc = properties.get("DEFAULT_NETLOC", "") return default_scheme, default_netloc, os.path.abspath(location) @@ -406,6 +407,7 @@ def parse_location(location: str, properties: Properties = EMPTY_DICT) -> tuple[ else: return uri.scheme, uri.netloc, f"{uri.netloc}{uri.path}" + def _initialize_fs(self, scheme: str, netloc: str | None = None) -> FileSystem: """Initialize FileSystem for different scheme.""" if scheme in {"oss"}: