fix: align stat metadata content-type output with mc#48
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the rc stat CLI command’s human-readable output to match mc stat expectations by moving Content-Type into a dedicated metadata display section and ensuring the Type field reflects the object kind rather than the MIME type.
Changes:
- Added
build_display_metadata()to compose sorted, human-readable metadata (includingContent-TypeplusX-Amz-Meta-*entries). - Changed human-readable
Typeoutput from MIME type to a fixed object kind (file) and introduced aMetadatasection. - Added a unit test verifying
build_display_metadata()includesContent-Type.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Mar 9, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes
rc statoutput parity withmc statfor object metadata display.Fixes #46.
Problem
When running
rc statfor an object, the output showed:Type : text/plain(MIME type in theTypefield)Metadatasection containingContent-TypeIssue #46 reports that
Content-Typeshould be shown in metadata output similarly tomc stat.Root Cause
stathuman-readable formatting treatedcontent_typeas theTypefield and only rendered user-defined metadata (x-amz-meta-*) lines, soContent-Typewas never emitted as metadata.Changes
build_display_metadata()to compose sorted metadata lines for display.Type : filein human-readable output.Metadatasection in human-readable output.Content-Typeinside the metadata display section.test_build_display_metadata_includes_content_type.Verification
Reproduction (before fix)
Using Docker RustFS latest:
docker compose -f docker/docker-compose.yml up -d rustfscargo run -- alias set local http://localhost:9000 accesskey secretkeycargo run -- mb local/issue46-bucketcargo run -- cp /tmp/issue46.txt local/issue46-bucket/issue46.txtcargo run -- stat local/issue46-bucket/issue46.txtObserved before fix:
Type : text/plainMetadatasection / noContent-Typemetadata lineAfter fix
Now output includes:
Type : fileMetadata :Content-Type : text/plainQuality Gates
cargo fmt --all --checkcargo clippy --workspace -- -D warningscargo test --workspaceAll passed.
Similar Issue Scan
Searched other CLI commands for comparable
content_typedisplay bugs; no additional stat-like human-readable metadata formatting paths requiring fixes were found.