[codex] support STAC file local paths for asset downloads#905
[codex] support STAC file local paths for asset downloads#905therealclvn wants to merge 2 commits into
Conversation
soxofaan
left a comment
There was a problem hiding this comment.
some notes
(note however that this is a low-priority feature, as there are no openEO backends in the wild as far as I known that provide this metadata)
|
|
||
| ### Added | ||
|
|
||
| - Support STAC `file:local_path` for asset download target paths. ([#902](https://github.com/Open-EO/openeo-python-client/issues/902)) |
There was a problem hiding this comment.
append new list items at bottom of section
There was a problem hiding this comment.
Moved the changelog entry to the bottom of the Added section in 942b238.
| job=job, | ||
| key="asset", | ||
| href=href, | ||
| metadata={"type": "image/tiff", "file:local_path": "tiles/2026/result.tiff"}, |
There was a problem hiding this comment.
make sure to cover all aspects of the file:local_path validation: windows separators, "..", empty dirs, non-relative paths, ....
There was a problem hiding this comment.
Added invalid file:local_path cases for Windows separators, parent traversal, absolute paths, and empty paths in 942b238.
| path = PurePosixPath(local_path) | ||
| if path.is_absolute() or any(p == ".." for p in path.parts): | ||
| return None | ||
| parts = [p for p in path.parts if p not in {"", "."}] |
There was a problem hiding this comment.
when local_path violates something (and None is returned): I would also trigger a warning to inform the user that something is wrong here
There was a problem hiding this comment.
Added a warning when invalid file:local_path metadata is ignored in 942b238.
415f4af to
942b238
Compare
Summary
file:local_pathwhen constructing asset download paths for directory targets..traversal, or Windows-style backslashes and fall back to the existing filename logicCloses #902.
Validation
.venv/bin/python -m pytest tests/rest/test_job.py::TestResultAsset::test_download_uses_file_local_path -qfailed because the filename fell back toasset-asset.tiff.venv/bin/python -m pytest tests/rest/test_job.py::TestResultAsset::test_download_uses_file_local_path -q.venv/bin/python -m pytest tests/rest/test_job.py -q.venv/bin/python -m compileall openeo/rest/job.py tests/rest/test_job.pygit diff --check