Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neofs-cli: fix pass of several object put --attributes flags #2569

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ minor release, the component will be purged, so be prepared (see `Updating` sect
- Missing removed but locked objects in `SEARCH`'s results (#2526)
- LOCK objects and regular objects expiration conflicts (#2392)
- SN responds with a different node information compared to a bootstrapping contract call's argument (#2568)
- `neofs-cli object put` command processes multiple `--attributes` flags (#2427)

### Removed
- Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR config sections (#2400)
Expand Down
8 changes: 3 additions & 5 deletions cmd/neofs-cli/modules/object/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func initObjectPutCmd() {

flags.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)

flags.String("attributes", "", "User attributes in form of Key1=Value1,Key2=Value2")
flags.StringSlice("attributes", []string{}, "User attributes in form of Key1=Value1,Key2=Value2")
flags.Bool("disable-filename", false, "Do not set well-known filename attribute")
flags.Bool("disable-timestamp", false, "Do not set well-known timestamp attribute")
flags.Uint64VarP(&putExpiredOn, commonflags.ExpireAt, "e", 0, "The last active epoch in the life of the object")
Expand Down Expand Up @@ -187,10 +187,8 @@ func putObject(cmd *cobra.Command, _ []string) {
func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) {
var rawAttrs []string

raw := cmd.Flag("attributes").Value.String()
if len(raw) != 0 {
rawAttrs = strings.Split(raw, ",")
}
rawAttrs, err := cmd.Flags().GetStringSlice("attributes")
common.ExitOnErr(cmd, "can't get attributes: %w", err)

attrs := make([]object.Attribute, len(rawAttrs), len(rawAttrs)+2) // name + timestamp attributes
for i := range rawAttrs {
Expand Down
Loading