Skip to content

Commit

Permalink
Don't strip strings on output
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Aug 13, 2018
1 parent 58f46da commit 5e344d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions parse/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ func ConvertSimple(fieldType string, value interface{}, op Operation) (interface
case "password":
return convert.ToString(value), nil
case "string":
if op.IsList() {
return convert.ToStringNoTrim(value), nil
}
return convert.ToString(value), nil
case "dnsLabel":
str := convert.ToString(value)
Expand Down
8 changes: 6 additions & 2 deletions types/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ func Singular(value interface{}) interface{} {
return value
}

func ToString(value interface{}) string {
func ToStringNoTrim(value interface{}) string {
if t, ok := value.(time.Time); ok {
return t.Format(time.RFC3339)
}
single := Singular(value)
if single == nil {
return ""
}
return strings.TrimSpace(fmt.Sprint(single))
return fmt.Sprint(single)
}

func ToString(value interface{}) string {
return strings.TrimSpace(ToStringNoTrim(value))
}

func ToTimestamp(value interface{}) (int64, error) {
Expand Down

0 comments on commit 5e344d9

Please sign in to comment.