Skip to content

Commit 8a1c308

Browse files
committed
fix(cli): stores import csv strip all BOMs from payload.
Signed-off-by: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
1 parent 04d84bd commit 8a1c308

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/storesBulkOperations.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ var (
4747
}
4848
)
4949

50+
const bom = "\uFEFF"
51+
52+
func stripAllBOMs(s string) string {
53+
return strings.ReplaceAll(s, bom, "")
54+
}
55+
5056
// formatProperties will iterate through the properties of a json object and convert any "int" values to strings
5157
// this is required because the Keyfactor API expects all properties to be strings
5258
func formatProperties(json *gabs.Container, reqPropertiesForStoreType []string) *gabs.Container {
@@ -355,7 +361,7 @@ If you do not wish to include credentials in your CSV file they can be provided
355361
Value: &storePassword,
356362
}
357363
}
358-
mJSON := reqJson.String()
364+
mJSON := stripAllBOMs(reqJson.String())
359365
conversionError := json.Unmarshal([]byte(mJSON), &createStoreReqParameters)
360366

361367
if conversionError != nil {

0 commit comments

Comments
 (0)