Skip to content

Commit

Permalink
Remove new lines from strings (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
suxor42 authored Jun 14, 2023
1 parent 51af594 commit b3e4643
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/csvexport/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"sort"
"strconv"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
Expand Down Expand Up @@ -160,7 +161,7 @@ func DynamoToCSV(db Storage, ctx context.Context, scanOpt ScanOption, opts ...Op
// protect exponential notation layout
record = append(record, strconv.FormatFloat(val, 'f', -1, 64))
case string:
record = append(record, val)
record = append(record, removeNewLines(val))
default:
js, err := json.Marshal(value)
if err != nil {
Expand Down Expand Up @@ -259,3 +260,7 @@ func UploadToS3(b []byte, client s3iface.S3API, bucket, path, fname string) erro

return nil
}

func removeNewLines(s string) string {
return strings.ReplaceAll(s, "\n", " ")
}

0 comments on commit b3e4643

Please sign in to comment.