Skip to content

Commit

Permalink
Merge pull request #35 from d-strobel/fix/local-group-update
Browse files Browse the repository at this point in the history
fix: local.GroupUpdate cannot update empty description
  • Loading branch information
d-strobel authored Jan 12, 2024
2 parents 566c4d2 + 23604de commit 51935fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion windows/local/local_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ func (c *LocalClient) GroupUpdate(ctx context.Context, params GroupUpdateParams)
cmds = append(cmds, fmt.Sprintf("-Name '%s'", params.Name))
}

cmds = append(cmds, fmt.Sprintf("-Description '%s'", params.Description))
if params.Description == "" {
cmds = append(cmds, "-Description ' '")
} else {
cmds = append(cmds, fmt.Sprintf("-Description '%s'", params.Description))
}

cmd := strings.Join(cmds, " ")

// Run command
Expand Down
2 changes: 1 addition & 1 deletion windows/local/local_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (suite *LocalUnitTestSuite) TestGroupUpdate() {
{
"assert with Name parameter",
GroupUpdateParams{Name: "Test"},
"Set-LocalGroup -Name 'Test' -Description ''",
"Set-LocalGroup -Name 'Test' -Description ' '",
},
}

Expand Down

0 comments on commit 51935fc

Please sign in to comment.