Skip to content

test(cors): reject object paths for bucket cors#135

Draft
overtrue wants to merge 1 commit intomainfrom
codex/test-gap-detection-202604171530
Draft

test(cors): reject object paths for bucket cors#135
overtrue wants to merge 1 commit intomainfrom
codex/test-gap-detection-202604171530

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

This PR closes a small test gap in the new bucket CORS path handling. The CORS commands are documented and implemented as bucket-level operations, so object-style targets such as local/my-bucket/object.txt should be rejected before any network operation is attempted.

The previous parser only split the path into alias and the remaining string, then trimmed trailing slashes. That meant local/my-bucket/object.txt was accepted as a bucket name containing a slash, which could lead users toward confusing downstream S3 errors instead of a direct usage error.

The fix keeps trailing slash support for local/my-bucket/ but rejects bucket targets that still contain a slash after normalization. The focused unit test covers this rejected object-path case alongside the existing invalid CORS bucket path cases.

Validation

  • cargo test -p rustfs-cli commands::cors::tests::test_parse_bucket_path_error
  • make pre-commit (unavailable: no pre-commit target exists)
  • cargo fmt --all -- --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant