Skip to content

Commit

Permalink
Merge pull request #334 from jmpsec/encoding-error-bytea
Browse files Browse the repository at this point in the history
Fix for encoding error enrolling new nodes
  • Loading branch information
javuto committed Jan 11, 2023
2 parents bcdd750 + b6e9b84 commit b929e82
Show file tree
Hide file tree
Showing 6 changed files with 507 additions and 11 deletions.
6 changes: 3 additions & 3 deletions admin/handlers/utils.go
Expand Up @@ -143,10 +143,10 @@ func removeBackslash(rawString string) string {
return strings.ReplaceAll(rawString, "\\", " ")
}

// Helper to convert json.RawMessage into indented string
func jsonRawIndent(raw json.RawMessage) string {
// Helper to convert string into indented string
func jsonRawIndent(raw string) string {
var out bytes.Buffer
if err := json.Indent(&out, raw, "", " "); err != nil {
if err := json.Indent(&out, []byte(raw), "", " "); err != nil {
return string(raw)
}
return string(out.Bytes())
Expand Down
6 changes: 3 additions & 3 deletions admin/utils.go
Expand Up @@ -71,10 +71,10 @@ func incMetric(name string) {
}
}

// Helper to convert json.RawMessage into indented string
func jsonRawIndent(raw json.RawMessage) string {
// Helper to convert string into indented string
func jsonRawIndent(raw string) string {
var out bytes.Buffer
if err := json.Indent(&out, raw, "", " "); err != nil {
if err := json.Indent(&out, []byte(raw), "", " "); err != nil {
return string(raw)
}
return string(out.Bytes())
Expand Down

0 comments on commit b929e82

Please sign in to comment.