Skip to content

fix(storage): refuse bucket URLs naming no object directly in fetch_uri (#435) - #438

Merged
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
Cid-oe:fix/issue-435-fetch-uri-names-no-object
Sep 6, 2026
Merged

kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
Cid-oe:fix/issue-435-fetch-uri-names-no-object

Conversation

@Cid-oe

@Cid-oe Cid-oe commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves #435.

Ensures fetch_uri explicitly validates and refuses bucket URLs that name no object before delegating to BucketStorageRoot, returning an error citing the exact URI supplied by the caller instead of a truncated prefix.

Changes

  • In src/hflow/storage.py: checked that the bucket URL contains an object segment after the bucket/container before delegating to BucketStorageRoot.
  • In tests/test_storage.py: added test_bucket_uri_naming_no_object_is_refused in TestFetchUri testing trailing slashes (gs://bucket/, s3://bucket/prefix/, gs://bucket//) and bare bucket names (gs://bucket, s3://bucket).
  • Formatted and linted with ruff.

Validation

  • uv run pytest -q tests/test_storage.py (44 passed, 1 skipped)
  • uv run ruff check src/hflow/storage.py tests/test_storage.py
  • uv run ruff format --check src/hflow/storage.py tests/test_storage.py

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

👋 Hi @Cid-oe — thank you so much for your first contribution to HFlow!

A maintainer will review your pull request as soon as possible. In the meantime:

💡 Tip: one open pull request per contributor at a time. Issues with an assignee are taken; everything else is fair game.

We are excited to have you here and appreciate your help making the project better! 🙌

@kstonekuan kstonekuan left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, merging.

re.escape(repr(uri)) is the careful version: . unescaped matches anything, so the pattern would have passed on messages it should not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants