Skip to content

Commit 115bc90

Browse files
Enhance URI scheme validation for Windows paths
1 parent 8691d94 commit 115bc90

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pyiceberg/io/pyarrow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ def parse_location(location: str, properties: Properties = EMPTY_DICT) -> tuple[
397397
"""
398398
uri = urlparse(location)
399399

400-
if not uri.scheme:
400+
if not uri.scheme or (len(uri.scheme) == 1 and uri.scheme.isalpha()):
401+
# len == 1 and alpha catches Windows drive letters like C:\ D:\
401402
default_scheme = properties.get("DEFAULT_SCHEME", "file")
402403
default_netloc = properties.get("DEFAULT_NETLOC", "")
403404
return default_scheme, default_netloc, os.path.abspath(location)
@@ -406,6 +407,7 @@ def parse_location(location: str, properties: Properties = EMPTY_DICT) -> tuple[
406407
else:
407408
return uri.scheme, uri.netloc, f"{uri.netloc}{uri.path}"
408409

410+
409411
def _initialize_fs(self, scheme: str, netloc: str | None = None) -> FileSystem:
410412
"""Initialize FileSystem for different scheme."""
411413
if scheme in {"oss"}:

0 commit comments

Comments
 (0)