mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-16 02:58:14 +02:00
removed manual unescape as jsonv2 does it alreadyfor us
This commit is contained in:
1 parent
10f4f28312
commit
f611256d90
1 file changed
+2
-14
@@ -8,7 +8,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
@@ -667,22 +666,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func marhshalWithoutEscape(v any, prefix string, indent string) ([]byte, error) {
|
func marhshalWithoutEscape(v any, prefix string, indent string) ([]byte, error) {
|
||||||
raw, err := json.Marshal(v,
|
return json.Marshal(v,
|
||||||
json.Deterministic(true),
|
|
||||||
jsontext.WithIndentPrefix(prefix),
|
jsontext.WithIndentPrefix(prefix),
|
||||||
jsontext.WithIndent(indent),
|
jsontext.WithIndent(indent),
|
||||||
|
json.Deterministic(true),
|
||||||
)
|
)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// unescape escaped unicode characters
|
|
||||||
unescaped, err := strconv.Unquote(strings.ReplaceAll(strconv.Quote(string(raw)), `\\u`, `\u`))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return []byte(unescaped), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func escapeBacktick(v string) string {
|
func escapeBacktick(v string) string {
|
||||||
|
|||||||
Reference in new issue
Block a user