Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Added

- Added support for local asset paths using file URIs: ([#254](https://github.com/stac-utils/stac-asset/pull/254))

## [0.4.7] - 2025-06-18

### Changed
Expand Down
3 changes: 2 additions & 1 deletion src/stac_asset/filesystem_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ async def open_url(

async def assert_href_exists(self, href: str) -> None:
"""Asserts that an href exists."""
if not os.path.exists(href):
url = URL(href)
if not os.path.exists(url.path):
raise ValueError(f"href does not exist on the filesystem: {href}")

async def __aenter__(self) -> FilesystemClient:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_filesystem_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ async def test_download(tmp_path: Path, asset_href: str) -> None:
async def test_href_exists(asset_href: str) -> None:
async with FilesystemClient() as client:
assert await client.href_exists(asset_href)


async def test_href_exists_file_uri(asset_href: str) -> None:
async with FilesystemClient() as client:
assert await client.href_exists(f"file://{asset_href}")