Fix corrupt json bug in jsn package

This commit is contained in:
Vikram Rangnekar
2020-02-24 01:59:50 +05:30
parent 90694f8803
commit 51e105699e
8 changed files with 77 additions and 26 deletions

View File

@ -39,11 +39,16 @@ func argMap(ctx context.Context, vars []byte) func(w io.Writer, tag string) (int
}
v := fields[0].Value
// Open and close quotes
if len(v) >= 2 && v[0] == '"' && v[len(v)-1] == '"' {
fields[0].Value = v[1 : len(v)-1]
}
if tag == "cursor" {
if bytes.EqualFold(v, []byte("null")) {
return io.WriteString(w, ``)
}
v1, err := decrypt(string(fields[0].Value))
if err != nil {
return 0, err
@ -52,6 +57,8 @@ func argMap(ctx context.Context, vars []byte) func(w io.Writer, tag string) (int
return w.Write(v1)
}
fmt.Println(">>>", tag, string(v))
return w.Write(escQuote(fields[0].Value))
}
}