Skip to content

Commit e4f78fc

Browse files
committed
fix: updated handling of protocol
1 parent 72b37fc commit e4f78fc

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/eodm/cli/_filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ def _get_fsspec_fs(protocol: str, profile: Optional[str]) -> fsspec.AbstractFile
2828
"endpoint_url": endpoint_url,
2929
},
3030
)
31-
return fsspec.filesystem(protocol, profile=profile)
31+
return fsspec.filesystem(protocol)

src/eodm/cli/load/apps/stac_catalog.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def items(
102102
items: Annotated[typer.FileText, typer.Argument()] = sys.stdin, # type: ignore
103103
source_profile: Optional[str] = None,
104104
target_profile: Optional[str] = None,
105+
source_protocol: str = "file",
105106
chunk_size: int = 100000,
106107
update: bool = False,
107108
) -> None:
@@ -114,9 +115,9 @@ def items(
114115

115116
catalog_base_path = os.path.dirname(catalog_path)
116117

117-
protocol = urlparse(str(catalog_path)).scheme or "file"
118-
source_filesystem = _get_fsspec_fs(protocol, profile=source_profile)
119-
target_filesystem = _get_fsspec_fs(protocol, profile=target_profile)
118+
target_protocol = urlparse(str(catalog_path)).scheme or "file"
119+
source_filesystem = _get_fsspec_fs(source_protocol, profile=source_profile)
120+
target_filesystem = _get_fsspec_fs(target_protocol, profile=target_profile)
120121
catalog = Catalog.from_file(catalog_path, FSSpecStacIO(filesystem=target_filesystem))
121122

122123
collections: set[Collection] = set()
@@ -141,8 +142,6 @@ def items(
141142
catalog_base_path, collection.id, item.id, asset_file
142143
)
143144

144-
protocol = urlparse(str(asset.href)).scheme or "file"
145-
146145
if not target_filesystem.exists(final_path) or update:
147146
with (
148147
source_filesystem.open(asset.href) as s,

0 commit comments

Comments
 (0)