Skip to content

Commit

Permalink
Trim quotes when returning selector comments (#3940)
Browse files Browse the repository at this point in the history
Let's not return the description quoted to the user.

Related: #3723
  • Loading branch information
jhrozek authored Jul 19, 2024
1 parent 5ad938d commit 8041df2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/db/profile_selector_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ func (s *ProfileSelector) Scan(value interface{}) error {
selector = strings.TrimSuffix(selector, "\"")
s.Selector = selector

s.Comment = parts[4]
comment := strings.TrimPrefix(parts[4], "\"")
comment = strings.TrimSuffix(comment, "\"")
s.Comment = comment

return nil
}
2 changes: 1 addition & 1 deletion internal/db/profiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func TestProfileListWithSelectors(t *testing.T) {

noSelectors := createRandomProfile(t, randomEntities.proj.ID, []string{})
oneSelectorProfile := createRandomProfile(t, randomEntities.proj.ID, []string{})
oneSel := createRepoSelector(t, oneSelectorProfile.ID, "one_selector1", "one_comment1")
oneSel := createRepoSelector(t, oneSelectorProfile.ID, "one_selector1", "multi word comment")

multiSelectorProfile := createRandomProfile(t, randomEntities.proj.ID, []string{})
mulitSel1 := createRepoSelector(t, multiSelectorProfile.ID, "multi_selector1", "multi_comment1")
Expand Down

0 comments on commit 8041df2

Please sign in to comment.