aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_set_title.go
diff options
context:
space:
mode:
Diffstat (limited to 'bug/op_set_title.go')
-rw-r--r--bug/op_set_title.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/bug/op_set_title.go b/bug/op_set_title.go
index c6a26746..badd192c 100644
--- a/bug/op_set_title.go
+++ b/bug/op_set_title.go
@@ -3,7 +3,6 @@ package bug
import (
"encoding/json"
"fmt"
- "strings"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/identity"
@@ -49,20 +48,12 @@ func (op *SetTitleOperation) Validate() error {
return fmt.Errorf("title is empty")
}
- if strings.Contains(op.Title, "\n") {
- return fmt.Errorf("title should be a single line")
+ if !text.SafeOneLine(op.Title) {
+ return fmt.Errorf("title has unsafe characters")
}
- if !text.Safe(op.Title) {
- return fmt.Errorf("title should be fully printable")
- }
-
- if strings.Contains(op.Was, "\n") {
- return fmt.Errorf("previous title should be a single line")
- }
-
- if !text.Safe(op.Was) {
- return fmt.Errorf("previous title should be fully printable")
+ if !text.SafeOneLine(op.Was) {
+ return fmt.Errorf("previous title has unsafe characters")
}
return nil